diff --git a/.gitignore b/.gitignore index c478ba98a..1e1bc376f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # Editor backup files: *~ .*.swp -build/* +build*/ # Build output *.o diff --git a/AUTHORS.txt b/AUTHORS.md similarity index 100% rename from AUTHORS.txt rename to AUTHORS.md diff --git a/BuildSetup.cmake b/BuildSetup.cmake index 6356a4306..e14f4e57c 100644 --- a/BuildSetup.cmake +++ b/BuildSetup.cmake @@ -1,10 +1,7 @@ - -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: Included CMake file BuildSetup.cmake" ) -endif() - +# gpstk/BuildSetup.cmake #======================================== -# Set Platform-Dependent Options +# Try to keep all the platform dependent +# options in this file #======================================== #---------------------------------------- @@ -20,18 +17,20 @@ endif() # Platform-dependent Compiler flags #---------------------------------------- if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -compat=5 -erroff=hidevf,wvarhidemem,badargtype2w" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -erroff=hidevf,wvarhidemem,badargtype2w" ) + # add -DCMAKE_CXX_FLAGS=-std=c++03 or =-std=c++11 on the CMAKE invocation set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mt -shared" ) elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) set( CMAKE_SHARED_LIBRARY_SUFFIX .dylib ) set( CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -shared" ) elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2" ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -shared" ) elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) else() - message( ERROR "ERROR: CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}, not supported. Currently supported: Linux, Darwin, SunOS, " ) + message( ERROR "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}, not supported. Currently supported: Linux, Darwin, SunOS, Windows" ) endif() #---------------------------------------- @@ -76,97 +75,80 @@ endif( "${isSystemDir}" STREQUAL "-1" ) #---------------------------------------- -# Debug Messages -# -# The CMake command-line tool, message( STATUS ) displays -# messages on stdout and all other message types on stderr. -#---------------------------------------- - -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: CMAKE_SYSTEM = ${CMAKE_SYSTEM}" ) # e.g., Linux-3.2.0 - message( STATUS "DEBUG: CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" ) # e.g., Linux - message( STATUS "DEBUG: UNIX = ${UNIX}" ) # e.g., is the platform UNIX ? - message( STATUS "DEBUG: APPLE = ${APPLE}" ) # e.g., is the platform OSX? - message( STATUS "DEBUG: WIN32 = ${WIN32}" ) # e.g., is the platform Windows? - message( STATUS "DEBUG: MSVC11 = ${MSVC11}" ) # e.g., is the platform VisualStudio? - message( STATUS "DEBUG: MSVC12 = ${MSVC12}" ) # e.g., is the platform VisualStudio? - message( STATUS "DEBUG: CMAKE_COMMAND = ${CMAKE_COMMAND}" ) # e.g., /usr/bin/cmake - message( STATUS "DEBUG: CMAKE_VERSION = ${CMAKE_VERSION}" ) # e.g., 2.8.9 - message( STATUS "DEBUG: CMAKE_BUILD_TOOL = ${CMAKE_BUILD_TOOL}" ) # e.g., /usr/bin/make - message( STATUS "DEBUG: STADYN = ${STADYN}" ) - message( STATUS "DEBUG: CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}" ) - message( STATUS "DEBUG: CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" ) - message( STATUS "DEBUG: CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}" ) - message( STATUS "DEBUG: CMAKE_SKIP_BUILD_RPATH = ${CMAKE_SKIP_BUILD_RPATH}" ) - message( STATUS "DEBUG: CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}" ) - message( STATUS "DEBUG: CMAKE_BUILD_WITH_INSTALL_RPATH = ${CMAKE_BUILD_WITH_INSTALL_RPATH}" ) - message( STATUS "DEBUG: CMAKE_INSTALL_RPATH_USE_LINK_PATH = ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}" ) - message( STATUS "DEBUG: CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}" ) # e.g., $HOME/git/gpstk - message( STATUS "DEBUG: CMAKE_CURRENT_LIST_FILE = ${CMAKE_CURRENT_LIST_FILE}" ) # e.g., $HOME/git/gpstk/CMakeLists.txt - message( STATUS "DEBUG: CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk - message( STATUS "DEBUG: CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk - message( STATUS "DEBUG: CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build - message( STATUS "DEBUG: PROJECT_NAME = ${PROJECT_NAME}" ) # e.g., gpstk - message( STATUS "DEBUG: PROJECT_BINARY_DIR = ${PROJECT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build - message( STATUS "DEBUG: PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk - message( STATUS "DEBUG: CMAKE_INSTALL_DIR = ${CMAKE_INSTALL_DIR}" ) # e.g., /usr - message( STATUS "DEBUG: CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) # e.g., $HOME/.local/gpstk - if( BUILD_PYTHON ) - message( STATUS "DEBUG: PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) # e.g., $HOME/.local - endif() +if( DEBUG_SWITCH AND NOT DEBUG_VERBOSE ) + message( STATUS "CMAKE_SYSTEM = ${CMAKE_SYSTEM}" ) # e.g., Linux-3.2.0 + message( STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" ) # e.g., Linux + message( STATUS "UNIX = ${UNIX}" ) # e.g., is the platform UNIX ? + message( STATUS "APPLE = ${APPLE}" ) # e.g., is the platform OSX? + message( STATUS "WIN32 = ${WIN32}" ) # e.g., is the platform Windows? + message( STATUS "MSVC11 = ${MSVC11}" ) # e.g., is the platform VisualStudio? + message( STATUS "MSVC12 = ${MSVC12}" ) # e.g., is the platform VisualStudio? + message( STATUS "CMAKE_COMMAND = ${CMAKE_COMMAND}" ) # e.g., /usr/bin/cmake + message( STATUS "CMAKE_VERSION = ${CMAKE_VERSION}" ) # e.g., 2.8.9 + message( STATUS "CMAKE_BUILD_TOOL = ${CMAKE_BUILD_TOOL}" ) # e.g., /usr/bin/make + message( STATUS "STADYN = ${STADYN}" ) + message( STATUS "CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}" ) + message( STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" ) + message( STATUS "CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}" ) + message( STATUS "CMAKE_SKIP_BUILD_RPATH = ${CMAKE_SKIP_BUILD_RPATH}" ) + message( STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}" ) + message( STATUS "CMAKE_BUILD_WITH_INSTALL_RPATH = ${CMAKE_BUILD_WITH_INSTALL_RPATH}" ) + message( STATUS "CMAKE_INSTALL_RPATH_USE_LINK_PATH = ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}" ) + message( STATUS "CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}" ) # e.g., $HOME/git/gpstk + message( STATUS "CMAKE_CURRENT_LIST_FILE = ${CMAKE_CURRENT_LIST_FILE}" ) # e.g., $HOME/git/gpstk/CMakeLists.txt + message( STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk + message( STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk + message( STATUS "CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build + message( STATUS "PROJECT_NAME = ${PROJECT_NAME}" ) # e.g., gpstk + message( STATUS "PROJECT_BINARY_DIR = ${PROJECT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build + message( STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk + message( STATUS "CMAKE_INSTALL_DIR = ${CMAKE_INSTALL_DIR}" ) # e.g., /usr + message( STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) # e.g., $HOME/.local/gpstk endif() #---------------------------------------- -# Debug Verbose: print all cmake variables -#---------------------------------------- - if( DEBUG_VERBOSE ) get_cmake_property( _variableNames VARIABLES ) foreach( _variableName ${_variableNames} ) - message( STATUS "---- DEBUG VERBOSE: ${_variableName} = ${${_variableName}}" ) + message( STATUS "---- ${_variableName} = ${${_variableName}}" ) endforeach() endif() #---------------------------------------- # Get CMake vars into C++ #---------------------------------------- - configure_file( "${PROJECT_SOURCE_DIR}/build_config.h.in" "${PROJECT_BINARY_DIR}/generated/build_config.h" ) include_directories( "${PROJECT_BINARY_DIR}/generated/" ) install( FILES "${PROJECT_BINARY_DIR}/generated/build_config.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -#----------------------------------------- -# Build debs, tgz packages for binaries -# Usage: "$ make package" -#----------------------------------------- - +#---------------------------------------- +if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + set( CPACK_GENERATOR "TGZ" ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) + set( CPACK_GENERATOR "TGZ" ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) + set( CPACK_GENERATOR "DEB;TGZ" ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) + set( CPACK_GENERATOR "ZIP" ) +endif() set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "GPSTk libraries and applications for GNSS processing.") set( CPACK_PACKAGE_VENDOR "ARL:UT SGL" ) set( CPACK_PACKAGE_CONTACT "Bryan Parsons" ) -set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt" ) -set( CPACK_PACKAGE_VERSION_MAJOR "${gpstk_VERSION_MAJOR}" ) -set( CPACK_PACKAGE_VERSION_MINOR "${gpstk_VERSION_MINOR}" ) -set( CPACK_PACKAGE_VERSION_PATCH "${gpstk_VERSION_PATCH}" ) +set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md" ) +set( CPACK_PACKAGE_VERSION_MAJOR "${GPSTK_VERSION_MAJOR}" ) +set( CPACK_PACKAGE_VERSION_MINOR "${GPSTK_VERSION_MINOR}" ) +set( CPACK_PACKAGE_VERSION_PATCH "${GPSTK_VERSION_PATCH}" ) set( CPACK_INCLUDE_TOPLEVEL_DIRECTORY "OFF" ) +set( CPACK_PACKAGE_INSTALL_DIRECTORY "gpstk") +set( CPACK_TOPLEVEL_TAG "gpstk" ) set( CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.13)" ) set( CPACK_DEBIAN_SECTION "stable" ) set( CPACK_DEBIAN_PACKAGE_SECTION "science" ) -set( CPACK_GENERATOR "DEB;TGZ" ) - -#----------------------------------------- -# Build tgz packages for source release -# Usage: "$ make package_source" -#----------------------------------------- - -set( CPACK_SOURCE_IGNORE_FILES "/build/") +set( CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR}" "build-*/" "/.git" ) set( CPACK_SOURCE_GENERATOR "TGZ") include( CPack ) - -#---------------------------------------- -# The End -#---------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 75c875bdf..a7b315217 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,41 +8,27 @@ cmake_minimum_required( VERSION 2.8.5 ) -project( gpstk ) -set( "${PROJECT_NAME}_VERSION_MAJOR" "2" ) -set( "${PROJECT_NAME}_VERSION_MINOR" "6" ) -set( "${PROJECT_NAME}_VERSION_PATCH" "0" ) +project( GPSTK ) +set( GPSTK_VERSION_MAJOR "2" ) +set( GPSTK_VERSION_MINOR "7" ) +set( GPSTK_VERSION_PATCH "0" ) +set( GPSTK_VERSION "${GPSTK_VERSION_MAJOR}.${GPSTK_VERSION_MINOR}.${GPSTK_VERSION_PATCH}" ) #============================================================ # Set up #============================================================ -#---------------------------------------- -# Determine Installation Path Prefix -# Path to which we will install the -# gpstk /lib, /bin, and /include dirs. -#---------------------------------------- +# This sets up veriables contining GNU standard installation locations. +include( GNUInstallDirs ) -if( DEFINED CMAKE_INSTALL_PREFIX ) - message( STATUS "CMAKE_INSTALL_PREFIX was defined by user with the cmake command line. CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) -elseif( DEFINED ENV{gpstk} ) - set( CMAKE_INSTALL_PREFIX $ENV{gpstk} ) - message( STATUS "CMAKE_INSTALL_PREFIX was defined the environment variable ENV{gpstk}. CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX} " ) -else() - message( STATUS "CMAKE_INSTALL_PREFIX was not defined by any supported method." ) - message( STATUS "Either set an environment variable ENV{gpstk} or pass in a cmake variable as -DCMAKE_INSTALL_PREFIX") - message( FATAL_ERROR "CMAKE_INSTALL_PREFIX must be set by the user. Exitting now!" ) - return() -endif() +# For now, override to use 'lib' for the library install dir. +set( CMAKE_INSTALL_LIBDIR lib ) -include( GNUInstallDirs ) -# For now, overrride to use 'lib' for the library install dir. -set ( CMAKE_INSTALL_LIBDIR lib ) +# Set a filename for collecting exported targets. +set( EXPORT_TARGETS_FILENAME "GPSTKTargets" ) #---------------------------------------- # Option Switches -# -# Usage: option( "help string" [initial value] ) #---------------------------------------- option( DEBUG_SWITCH "HELP: DEBUG_SWITCH: Default = OFF, print some CMake variable values to stdout." OFF ) @@ -51,6 +37,12 @@ option( BUILD_EXT "HELP: BUILD_EXT: SWITCH, Default = OFF, Build the ext library option( TEST_SWITCH "HELP: TEST_SWITCH: SWITCH, Default = OFF, Turn on test mode." OFF ) option( BUILD_PYTHON "HELP: BUILD_PYTHON: SWITCH, Default = OFF, Turn on processing of python extension package." OFF ) +if( BUILD_PYTHON AND !BUILD_EXT ) + message( WARNING "Combination of BUILD_PYTHON=ON and BUILD_EXT=OFF is not allowed. Python swig bindings depend on gpstk/ext." ) + message( WARNING "Setting BUILD_EXT = TRUE" ) + set( BUILD_EXT TRUE ) +endif() + #---------------------------------------- # Pull in Build Config #---------------------------------------- @@ -139,30 +131,18 @@ endif() add_library( gpstk ${STADYN} ${GPSTK_SRC_FILES} ${GPSTK_INC_FILES} ) # GPSTk library install target -install( TARGETS gpstk DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${PROJECT_NAME}Config" ) +install( TARGETS gpstk DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${EXPORT_TARGETS_FILENAME}" ) -# GPSTk header file install target \todo without "/gpstk"? +# GPSTk header file install target install( FILES ${GPSTK_INC_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/gpstk" ) #============================================================ # Testing #============================================================ -# CMake command enable_testing() enables capability -# to use CMake add_test() command for this directory and below. -# This adds another build target, which is "test" for -# Makefile generators, or "RUN_TESTS" for IDEs (e.g. Visual Studio). -# From that point on, you can use the ADD_TEST() command -# to add tests cases to the project build target test: -# -# add_test( testname Exename arg1 arg2 ... ) -# -# Must call enable_test() prior to any add_subdirectory() -# that is intended to contain test cases. - if( TEST_SWITCH ) enable_testing() - list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules ) +# include( CTest ) endif( ) #---------------------------------------- @@ -174,22 +154,29 @@ add_subdirectory( core ) if( BUILD_EXT ) add_subdirectory( ext ) add_subdirectory( examples ) + if( BUILD_PYTHON ) + include( PythonSetup.cmake ) + add_subdirectory( swig ) + endif() endif() -if( BUILD_PYTHON ) - add_subdirectory( swig ) -endif() #---------------------------------------- # Export the project import cmake files. #---------------------------------------- - -configure_file( "${CMAKE_SOURCE_DIR}/ProjectConfig-misc.cmake.in" "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config-misc.cmake" ) -# \todo make smth with it -#install( FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config-misc.cmake" DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" ) -#install( EXPORT "${PROJECT_NAME}Config" DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" ) - -#============================================================ -# The End -#============================================================ - +#include( CMakePackageConfigHelpers ) +#set( INSTALL_CONFIG_DIR ${CMAKE_INSTALL_DATADIR}/cmake/GPSTK) +#configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/GPSTKConfig.cmake.in +# ${CMAKE_CURRENT_BINARY_DIR}/GPSTKConfig.cmake +# INSTALL_DESTINATION ${INSTALL_CONFIG_DIR} +# PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_BINDIR CMAKE_INSTALL_PREFIX INSTALL_CONFIG_DIR ) +#write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/GPSTKConfigVersion.cmake +# VERSION ${GPSTK_VERSION} +# COMPATIBILITY ExactVersion ) +#install( FILES +# ${CMAKE_CURRENT_BINARY_DIR}/GPSTKConfig.cmake +# ${CMAKE_CURRENT_BINARY_DIR}/GPSTKConfigVersion.cmake +# DESTINATION +# ${INSTALL_CONFIG_DIR} ) +# +#install( EXPORT ${EXPORT_TARGETS_FILENAME} DESTINATION ${INSTALL_CONFIG_DIR} ) diff --git a/COPYING.LESSER.txt b/COPYING.LESSER.md similarity index 100% rename from COPYING.LESSER.txt rename to COPYING.LESSER.md diff --git a/COPYING.txt b/COPYING.md similarity index 100% rename from COPYING.txt rename to COPYING.md diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 000000000..f83f70fcb --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,15 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## +## # The following are required to submit to the CDash dashboard: +## ENABLE_TESTING() +## INCLUDE(CTest) + +set(CTEST_PROJECT_NAME "GPSTk") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "cdash.arlut.utexas.edu") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=GPSTk") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/ChangeLog.txt b/ChangeLog.md similarity index 94% rename from ChangeLog.txt rename to ChangeLog.md index a0e745276..e04764e77 100644 --- a/ChangeLog.txt +++ b/ChangeLog.md @@ -1,3 +1,246 @@ + ################################################# + +Version 2.7 Friday, October 16, 2015 + + General modifications + --------------------- + - Supported Platform updated + - Solaris Sparc no longer supported + - XCode no longer supported + - Substantial Clean-up and Updates to build.sh script + - Python bindings now work under Linux, Solaris, & Mac + - CTest Infrastructure Complete - all platforms + - C++ test code tested and works on all platforms + - Linux, Solaris, OSx , Windows (VS2012) + - This include tests for library + - CDash Scripts added to repository + - More Unit Tests code added for Core + - Bug fixes for RINEX tools + - Sinex Bug Fix for Solaris x86 + - SVNumXRef moved from /ext/lib/Misc to /core/lig/GNSSCore + - Additional in-source documentation + - This release includes new/modified source code comments for improved readability. + - Various Bug and Compile Warning Fixes + + Modifications by Author + --------------------- +Anthony Hughes (14): + Ensure that SinexBlock contents are subclasses of Sinex::DataType. + Updated BINEX classes with latest MSN changes: typedefs, bugfixes, and tweeks. + Added GPSTK_ASSERT macro. + Added CommandOptionWithDecimalArg. + Added const versions of encodeVar and decodeVar; added some inline directives; fixed a decodeVar unit test error. + Added back memory.h after accidentally removing it. + Made getFitInterval static; added isValid and isDataSet. + Removed broken arbitrary location encodeVar(). + Added public accessors for ObsID. + Added CommandOptionNof. + Added an index parameter to CommandOption::getOrder; changed 'order' attribute to a vector. + Added an edit method to IonoModelStore. + Added utility methods to EngNav: sv2page(), sfpage2svid(), and zcount2page(). + Added comparison operators for GPSWeekSecond to guide implicit type conversions. + +Audric Terry (6): + Updating SVNumXRef + Moved SVNumXRef from gpstk/ext/ to gpstk/core/ and added its test program to gpstk/core/tests/GNSSCore/. + Updated SVNumXRef.cpp to include SVN72/PRN08 relationship and changed a comment in xSVumXRef.cpp + Added end date to SVN40/PRN10 in SVNumXRef.cpp + fixed conditional statement + Updated SVNumXRef.cpp to include SVN36/PRN10 relationship. + +Brian Tolman (24): + fix bug introduced in previous commit + add leap second + Add sparse matrix package to Geomatics, add diagDopy to Matrix, small changes + fix for windows + fix for windows + small change to increase efficiency + Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk + avoid duplicate file name + refine sparse matrix classes and add test program + remove until a windows version works + subtle bug arises when no reference position supplied + fix and rename strip() that respects quotes + fix test for splitWithQuotes + handle repeated empty fields in splitWithQuotes + Fixed bug introduced by changing int to size_t everywhere + Add option to find millisecond clock adjusts + bug when string-without-trailer is shorter than trailer + update and repair several things in RINEX tools + not handling R ver.2 obs types correctly in warnings + another bug + add option to output in TEC units + add some functionality + bugs in decimate (--TN) and delete sats (--DS) + bug fix in inverseUT() for 1x1 matrix, other small additions + +Bryan Parsons (14): + Merge branch 'RC26' into 'master' + Merge branch 'SVNumXRef' into 'master' + Merge branch 'Rinex_Merger' into 'master' + Added initial files for CDash support + Merging CDash Integration feature branch into 'master' + Tweaks to Mac CDash scripts. + Tweaking Linux and Solaris nightly CDash scripts. + Removing CDash scripts from the GPSTk repository. + Merge branch 'issue_201_removescripts' into 'master' + Spelling Tweaks in build.sh. + Updated documents with new refactored build scripts and for RC27 release. + Resolving merge issues. + Minor tweak to setup.py.in to match new documentation name. + Merge branch 'issue_197_refactor_build' into 'master' + +Jason Vestuto (8): + Added test for zero input args to build.sh, and if found, call the usage() fucntion to print the help to the screen. + Updates to force building gpstk/ext when the python bindings are built. + Updates to comments for Python build configuration files. + Fixed PYTHON_VERSION variable names for custom python build config. + Custom python build config changes + SWIG, minor bug fix to doc.i created by CMake that caused a compiler error on OSX. + Merge branch 'master' into issue_121 + CMake Python Config, python version changed to match that of the shared test host. + +Jon C. Little (2): + So we can ignore all build directotries... + Still getting the hostname right on all platforms + +Jon Little (24): + Better diagnostics for the config mode + Code now compiles under solaris studio 12.4 with --std=c++11 option + Letting the default C++ ABI be used by CC. This can be overridden by specifying -DCMAKE_CXX_FLAGS=-std=c++11 on the cmake invocation + Merge branch 'master' into issue_185_c++11 + Fixing the test apps + Removing depricated tests for the MSC class + Fixing bugs found by clang + Merge remote-tracking branch 'origin' into issue_185_c++11 + Merge branch 'master' into issue_185_c++11 + Merge branch 'issue_185_c++11' into 'master' + First cut at making complete out of tree build + Now build through packages on Linux + Now builds and bundles on Darwin + Fixed problem with finding hostname under solaris + Now can do a joint build with sgltk + Updated PRSolve and Rinex3 support to allow the user to specify P code data is really Y code data. + Added back some reporting on tests + Making ctest work on multiple platforms. + Merge remote-tracking branch 'origin/master' into issue_197_refactor_build + Fixing the var for the python executable. I really don't know how this worked before :-/ + Merge remote-tracking branch 'origin/issue_197_refactor_build' into issue_197_refactor_build + Fixing problem with building the python package. + Merge remote-tracking branch 'origin' into issue_197_refactor_build + Merge remote-tracking branch 'origin/issue_197_refactor_build' into issue_197_refactor_build + +Joseph Voss (35): + Adding EngAlmanac Test - Uses classes from AlmanacDataGenerator to parse gps almanac files, creates comparison data and generates subframes for testing - Other subframes necessary are generated by hand, see comments in EngAlmanac_T - Debugging getUTC method, returns certain values out of range + Corrected binary sv id for subframe 4 page 25 which prevented the page from being stored + Refactored the get method tests + Finishing EngAlmanac_T - Conversion of WNlsf from the binary subframe to an integer value is incorrect due to an error in EngNav's convertXbit method. This method implicitly signs the values passed to it, causing an error for unsigned values - Conversion of DN from bthe binary subframe to an integer value is incorrect. The IS-GPS-200D states that the DN value is subframe 4 page 18 is right justified, but the gpstk treats it as left-justified - Resolved error in EngAlmanac_T UTC parameters - Closes 95 + Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk + Minor fixes to EngAlmanac test, DN test now passes + Initial commit of ObsRngDev Test - Working on initialization of ObsRngDev Object using Rinex Ephemeris Store - Using Rinex file stream for generator of ObsRngDev pseudorange data - Need to use Rinex to get receiver position and CommonTime object + Generated all the data necessary to construct the ORDS, but need new data files + Successfully generated ObsRngDev objects, completed basic test - RinexNavData time system set to GPS by default, bad. How else can time system be set? + Successfully created one IonoModel object using EngAlmanac, but too much overhead. Rewriting to generate IonoModelStore entirely by hand + Factoring tests into fail counters, 91 tests count as one - Added basic initialization tests for single frequency constructors - Completed get function testing + Decided to remove the RinexObs dependencies and generate Ords by hand Ran into invalid time system issues, can't find where the error is, so making test much simpler Committing to backup the existing test before the purge of RinexObs + Refactoring + Added calculation testing for every instance of ObsRngDev + Merge branch 'issue_89' into 'master' + Resetting a library file that was editted for testing + Fixed the way that floats are compared in ObsRngDev_T + Minor fixes to Matrix_SVD test (on the right branch this time) + Replaced CPPUNIT with TestUtil for ReferenceFrame_T - closes #73 + Merging Rinex3ClockData - Implemented dump member function - Implemented reallyPutRecord member function - Uses RinexSatID to support GNSS + Updating Rinex3ClockData with the RinexClockData public members + Initial commit of Rinex3Obs_T and all depending test files + Commenting out modifier function in Rinex3ClockData that broke the build + Fixed error within the NumberHeaderRecordsToBeWritten + Initial commit of Rinex3Nav_T and all dependent test files + Reverting back to current GPSTk Rinex3Clock class for testing + Initial commit of Rinex3Clock_T and all dependent test data files + Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk into Rinex_Merger + Minor changes to fix failing tests + Added Rinex version conversion tests to Rinex3Obs_T & Rinex3Nav_T + Merge branch 'issue_73' + Replaced hard-coded file seperator with a cross-platform call to getFileSep + Updated all RINEX tests to use a platform independent file seperator + Minor fix to errors that broke the build + Removing test from CMakeFile that's not in the GPSTK repo + +Josh King (1): + SVNumXRef updates + +Kevin Kraatz (3): + set firstObs TimeSytem to VERSION/TYPE if unset + add header edit for REC #/TYPE/VERS and ANT # + Fix writing of marker number + +Nick Fitzsimmons (1): + Update to CommonTime_T comments. + +Scot Nelsen (4): + Standardize variable names and versions numbering used in CMake build generation. + Add ext binaries to the list of targets in the gpstkTargets file. + Rework PythonSetup.cmake to import Python config through either system or custom config. + Remove extra python configurationfrom swig/CMakeLists.txt and ensure Python Interp and Libs versions match. + +Scotland Nelsen (4): + Standardize on "GPSTK" as the CMake project name. + Missed a usage of projectConfig.cmake.in in the CMakeLists.txt file. + Merge branch 'iss43' + Update swig/CMakeLists.txt to use non-deprecated python paths. + +Steve Johnson (1): + Rename 'small' and 'big' variables to avoid conflict with Qt when building on Windows + +anthony (11): + Merge branch 'issue_180_binex' into 'master' + Merge branch 'issue_181_assert' into 'master' + Merge branch 'issue_182_decimalarg' into 'master' + Merge branch 'issue_183_binutils' into 'master' + Merge branch 'issue_184_engeph' into 'master' + Merge branch 'issue_187_getObsID' into 'master' + Merge branch 'issue_188_CommandOptionNof' into 'master' + Merge branch 'issue_189_getOrder' into 'master' + Merge branch 'issue_191' into 'master' + Merge branch 'issue_192_engnav' into 'master' + Merge branch 'issue_195_GPSWeekSecond_Comparison' into 'master' + +aterry (1): + Merge branch 'svnumref' into 'master' + +kolensky (1): + Merge branch 'issue_198_prsolve_rinex2' into 'master' + +renfrob (16): + Added flag to PackedNavBits - Fully backward compatible + Extending OrbElem class hierarchy to cover GLONASS + Adding isSameData() method to OrbElemBase + Refactor OrbElemStore classes for greater commonality + Adding receiver ID option to PackedNavBits + Polymorphic behavior requires pointers. + Fix to addPackedBit( ) method. + Adding Rinex3Nav output options + Adding Sign & Mag capability to PackedNavBits + Adding OrbElemStore.getSatList() + Add method to override fit interval limit + Tweak boundary limits + Changes to support development of sgltk/apps/filetools/rnwcompare + Adding an overlooked modification + Fixing missing comma in CNAV raw output + Tweak to dump() output format. + +unknown (1): + fixes for windows + +vestuto (2): + Merge branch 'issue_121' into 'master' + Merge branch 'issue_185_c++11' into 'master' + + + + + ################################################# @@ -33,12 +276,8 @@ Anthony Hughes (40): Refactored the BINEX types tests to use the TestUtils stuff and to read test input from files. Updated some comments. Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk - Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk - Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk Added filters for build output and for OS/X file system droppings. Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk - Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk - Merge branch 'master' of repositories.arlut.utexas.edu:sgl/gpstk Refactored more BINEX tests to use TestUtils. Ignore Sublime Text temp files Adjusted (downward) test reporting granularity, avoided using of assert(), added fail text. diff --git a/CustomPythonSetup.cmake.template b/CustomPythonSetup.cmake.template new file mode 100644 index 000000000..8e44e1d1c --- /dev/null +++ b/CustomPythonSetup.cmake.template @@ -0,0 +1,36 @@ +#============================================================ +# +# Name = CustomPythonSetup.cmake.template +# Purpose = Template for Manual Config of Python +# Usage = Copy this file to CustomPythonTemplate.cmake and modifications. +# Notes = Should the CustomPythonTemplate.cmake file exist, the search +# for a python installation will be skipped in favor of the variables +# defined within the custom file. +#============================================================ + +# +# The following are varaibles set by the default python search. +# + +set( PYTHONINTERP_FOUND "TRUE" ) +set( PYTHON_EXECUTABLE + "/usr/bin/python" + CACHE FILEPATH "File Path to system python executable" ) +set( PYTHON_VERSION_MAJOR "2" CACHE VERSION "System Python version major" ) +set( PYTHON_VERSION_MINOR "7" CACHE VERSION "System Python version minor" ) +set( PYTHON_VERSION_PATCH "3" CACHE VERSION "System Python version patch" ) + +set( PYTHON_VERSION_STRING + "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" + CACHE VERSION "Python Interpreter version number" ) + +set( PYTHONLIBS_FOUND "TRUE" ) +set( PYTHON_LIBRARIES + "/usr/lib/libpython2.7.so" + CACHE FILEPATH "File Path to system python shared object library" ) +set( PYTHON_INCLUDE_DIRS + "/usr/include/python2.7" + CACHE PATH "Directory Path to system python includes" ) +set( PYTHONLIBS_VERSION_STRING + ${PYTHON_VERSION_STRING} + CACHE VERSION "Python Libraries version number" ) diff --git a/Doxyfile b/Doxyfile index eba199f21..059f997fc 100644 --- a/Doxyfile +++ b/Doxyfile @@ -52,7 +52,7 @@ PROJECT_LOGO = # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = doc +OUTPUT_DIRECTORY = gpstk_doc_dir # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -602,26 +602,26 @@ CITE_BIB_FILES = # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. -QUIET = NO +QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. -WARNINGS = YES +WARNINGS = NO # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. -WARN_IF_UNDOCUMENTED = YES +WARN_IF_UNDOCUMENTED = NO # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. -WARN_IF_DOC_ERROR = YES +WARN_IF_DOC_ERROR = NO # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters @@ -655,7 +655,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = . +INPUT = gpstk_sources # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -689,10 +689,8 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = ./tests \ - ./examples \ - ./core/apps \ - ./ext/apps +EXCLUDE = + # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. @@ -719,8 +717,7 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = ./tests \ - ./examples +EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -751,7 +748,7 @@ IMAGE_PATH = # If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = +INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. @@ -1497,8 +1494,7 @@ SEARCH_INCLUDES = YES # contain include files that are not input files but should be processed by # the preprocessor. -INCLUDE_PATH = ./ext/lib \ - ./core/lib +INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the diff --git a/GPSTKConfig.cmake.in b/GPSTKConfig.cmake.in new file mode 100644 index 000000000..22e61d9fa --- /dev/null +++ b/GPSTKConfig.cmake.in @@ -0,0 +1,32 @@ +# - GPSTk: GNSS data processing library and applications by SGL @ ARL:UT. +#The primary goals of the GPSTk project are to: +# * provide applications for use by the GNSS and satellite navigation community. +# * provide a core library to facilitate the development of GNSS applications. +# +#============================================================================== +# The source code provided by the GPSTk is distributed under the GNU LGPL, Version 3. +# +# * This license gives all users the right to use and redistribute the code. +# * Users of the GPSTk are not required to open their source, according to the LGPL. +# * This makes the GPSTk a practical choice for commercial projects. +# * Full text copies of the GPL (COPYING.txt) and the LGPL (COPYING.LESSER.txt) are included with the GPSTk distribution package. +# +# For more information about the GPL or LGP, please refer to the following: +# +# * http://www.gnu.org/copyleft/lesser.html +# * http://www.gnu.org/licenses/gpl-howto.html +#============================================================================== + +set( GPSTK_FOUND TRUE ) + +@PACKAGE_INIT@ + +set( GPSTK_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@" ) +set( GPSTK_BINDIR "@PACKAGE_CMAKE_INSTALL_BINDIR@" ) +set( GPSTK_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@" ) +set( GPSTK_RUNTIME_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@" ) +set( GPSTK_ROOT_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@" ) + +include("@PACKAGE_INSTALL_CONFIG_DIR@/@EXPORT_TARGETS_FILENAME@.cmake") + +message(STATUS "GPSTk found at ${GPSTK_ROOT_DIR}") \ No newline at end of file diff --git a/INSTALL.txt b/INSTALL.md similarity index 93% rename from INSTALL.txt rename to INSTALL.md index 0f5dfb2fe..b41f34be2 100644 --- a/INSTALL.txt +++ b/INSTALL.md @@ -88,7 +88,7 @@ will need to export the library install path if you install to a non-standard path. The build script will test your paths to and warn you if your installs cannot be found. -Typical system installs will look like this: +Typical builds (no install) will look like this: $ ./build.sh -e @@ -98,17 +98,17 @@ Typical user installs will look like this: $ ./build.sh -eu -Typical test install will look like this: +Typical test and install will look like this: $ export LD_LIBRARY_PATH=/tmp/test/lib:$LD_LIBRARY_PATH $ ./build.sh -et -i /tmp/test -Typical install and binary tarball package will look like this: +Typical install and binary tarball package (in build folder) will look like this: $ export LD_LIBRARY_PATH=/tmp/test/lib:$LD_LIBRARY_PATH - $ ./build.sh -eg + $ ./build.sh -ep -i /tmp/test UNIX-like Environment: Manual Build, Install, and Package: @@ -149,7 +149,7 @@ commands instead of build.sh: $ cd $gpstk_root/build - $ cmake -DPYTHON_INSTALL_PREFIX=$HOME/.local -DCMAKE_INSTALL_PREFIX=$HOME/.local/gpstk $gpstk_root + $ cmake -DPYTHON_INSTALL_PREFIX=$HOME/.local -DCMAKE_INSTALL_PREFIX=$HOME/.local/gpstk -DBUILD_EXT=1 -DBUILD_PYTHON=1 $gpstk_root $ export LD_LIBRARY_PATH=$HOME/.local/gpstk/lib:$LD_LIBRARY_PATH @@ -175,8 +175,7 @@ commands instead of build.sh: UNIX-like Environment: Python Bindings Build and Install: --------------------------------------------------------- -The build.sh script must be used to build and install the GPSTk Python Bindings. See the script help for details -on those parameters: +As the build.sh script builds the Python Bindings by default: $ cd $gpstk_root @@ -189,15 +188,15 @@ you if your installs cannot be found. Typical system installs with python bindings will look like this: - $ ./build.sh -ep + $ ./build.sh -e Typical user installs with python bindings will look like this: - $ ./build.sh -eup + $ ./build.sh -eu Typical user installs with python bindings and documentation will look like this: - $ ./build.sh -eupd + $ ./build.sh -eud OSX and XCode: Building and Installing with CMake: diff --git a/LICENSE.txt b/LICENSE.md similarity index 100% rename from LICENSE.txt rename to LICENSE.md diff --git a/NEWS.txt b/NEWS.md similarity index 93% rename from NEWS.txt rename to NEWS.md index dcd441481..6ba1d2c92 100644 --- a/NEWS.txt +++ b/NEWS.md @@ -2,6 +2,9 @@ $Id$ GPS Toolkit News ------------------------------------------------------------------------------ + October 16, 2015 . . Release Candidate for Version 2.7 is frozen in the + repository + May 12, 2015 . . . . Release Candidate for Version 2.6 is frozen in the repository diff --git a/PYTHON.txt b/PYTHON.md old mode 100755 new mode 100644 similarity index 100% rename from PYTHON.txt rename to PYTHON.md diff --git a/ProjectConfig-misc.cmake.in b/ProjectConfig-misc.cmake.in deleted file mode 100644 index d20091301..000000000 --- a/ProjectConfig-misc.cmake.in +++ /dev/null @@ -1,2 +0,0 @@ - -set( "@PROJECT_NAME@_INCLUDE_DIR" "@CMAKE_INSTALL_INCLUDEDIR@" ) \ No newline at end of file diff --git a/PythonSetup.cmake b/PythonSetup.cmake index defe25380..280a19a0b 100644 --- a/PythonSetup.cmake +++ b/PythonSetup.cmake @@ -1,42 +1,65 @@ #============================================================ # # Name = PythonSetup.cmake -# Purpose = Template for Manual Config of Python for SWIG Bindings +# Purpose = Determine locations of Python library for use by SWIG # Usage = add "include( PythonSetup.cmake )" to the appropriate CMakeLists.txt -# Notes = On systems where the user may have many installations -# of python, CMake find_package( PythonLibs ) can often -# not find matching version numbers for the python library +# +# Scheme = Top-Level CMakeLists.txt includes this present file +# First step herein is to look for a CustomPythonSetup.cmake +# If that fails, this file then tries the "normal" method to find PythonLibs +# If CMake cannot figure out which Python library to use by that method +# then modify the template CustomPythonSetup.cmake file to explicitly +# define the paths to the python library and headers you wish SWIG to use. +# +# Reason = On systems where the user may have many installations +# of python, e.g. RedHat or OSX where the system version of Python +# is an old version not really intended for daily user use, so the user often +# installs an additional python environment from source or with some package manager. +# CMake find_package( PythonLibs ) will often stumble on pieces of multiple Python installs +# in an order that results in mismatching version numbers for the python library # and the python include files, and thus cannot build the # typemaps for wrapping the C++ code. -# The template below helps the user specify explicitly -# which components of their python install that CMake/SWIG -# should use. +# #============================================================ -set( PYTHON "/usr/bin/python" ) -set( PYTHON_EXECUTABLE "/usr/bin/python" CACHE FILEPATH "File Path to system python executable" ) -set( PYTHON_LIBRARY "/usr/lib/libpython2.7.so" CACHE FILEPATH "File Path to system python shared object library" ) -set( PYTHON_LIBRARIES "/usr/lib/libpython2.7.so" CACHE FILEPATH "File Path to system python shared object library" ) -set( PYTHON_INCLUDE_DIR "/usr/include/python2.7" CACHE PATH "Directory Path to system python includes" ) -set( PYTHON_VERSION "2.7.6" CACHE VERSION "System Python version number" ) -set( PYTHON_FOUND "TRUE" ) -set( PYTHONLIBS_FOUND "TRUE" ) +#------------------------------------------------------------ +# If the user provides a custom Python configuration, use it +#------------------------------------------------------------ +include( CustomPythonSetup.cmake + OPTIONAL + RESULT_VARIABLE PYTHON_CUSTOM_CONFIG ) -set( PYTHON_INSTALL_PREFIX $CMAKE_INSTALL_PREFIX ) +#------------------------------------------------------------ +# If a user-speccified python configuration is not found, let CMake try to find the system python +#------------------------------------------------------------ +if( ${PYTHON_CUSTOM_CONFIG} MATCHES "NOTFOUND" ) + find_package( PythonInterp 2.7 ) + find_package( PythonLibs ${PYTHON_VERSION_STRING} REQUIRED ) +endif() -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_FOUND = ${PYTHON_FOUND}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHONLIBS_FOUND = ${PYTHONLIBS_FOUND}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_VERSION = ${PYTHON_VERSION}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON = ${PYTHON}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_LIBRARY = ${PYTHON_LIBRARY}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_INCLUDE_DIR = ${PYTHON_INCLUDE_DIR}" ) - message( STATUS "DEBUG: PythonConfig.cmake: PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) -enif() -#============================================================ -# The End -#============================================================ \ No newline at end of file +#------------------------------------------------------------ +# Debug messaging +#------------------------------------------------------------ +if( DEBUG_SWITCH OR NOT PYTHONLIBS_FOUND) + message( STATUS "PYTHONINTERP_FOUND = ${PYTHONINTERP_FOUND}" ) + message( STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) + message( STATUS "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}" ) + message( STATUS "PYTHONLIBS_FOUND = ${PYTHONLIBS_FOUND}" ) + message( STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}" ) + message( STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}" ) + message( STATUS "PYTHONLIBS_VERSION_STRING = ${PYTHONLIBS_VERSION_STRING}" ) + message( STATUS "PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) +endif() + +#------------------------------------------------------------ +# Consistent python library and headers could not be found +#------------------------------------------------------------ +if( NOT PYTHONLIBS_FOUND ) + message( STATUS "Cannot find requested version of PYTHONLIBS on your system." ) + message( STATUS "Cannot build swig bindings without the right python libraries." ) + message( STATUS "PYTHON_LIBRARY and PYTHON_INCLUDE_DIR versions must match PYTHON_EXECUTABLE." ) + message( FATAL_ERROR "Cannot find PYTHONLIBS. Cannot proceed. Exiting now!" ) + return() +endif() diff --git a/README.txt b/README.md similarity index 97% rename from README.txt rename to README.md index 0be49186b..cf9aba843 100644 --- a/README.txt +++ b/README.md @@ -163,9 +163,9 @@ To build and install the C++ library and applications on POSIX platforms: To build and install the python bindings, you have two options: -* automated: run the build.sh, minimally with the "-p" flag. +* automated: python bindings automatically build with the build.sh. Use -P for install. * manual build: see build.sh for examples on calling cmake and swig -* manual install: use the setup.py script in the install_package path. See $GPSTK/swig/install_package/INSTALL.txt for more details +* manual install: Testing: diff --git a/TESTING.txt b/TESTING.md similarity index 94% rename from TESTING.txt rename to TESTING.md index a4729a741..32d78c99d 100755 --- a/TESTING.txt +++ b/TESTING.md @@ -20,7 +20,7 @@ Introduction: As an open source project, the source of the GPSTk is subject to intermittent updates, contributions, and corrections. The GPSTk library testing process has been redesigned to build confidence in the -functionality of the library. Testing within the GPSTk library is designed with three distinct goals +functionality of the library. Testing within the GPSTk library is designed with the following distinct goals in mind: Testing is repeatable with a low amount of effort. @@ -40,17 +40,15 @@ There are two main methods for running the GPSTk test suite in a UNIX-like Envir Automated build and test utilizing the build.sh script Manual build and test utilizing CMake and CTest -NOTE: The automated build provides testing metrics that are not available through the manual build. - UNIX-like Environment: Automated Build and Test: ------------------------------------------------ -If you prefer automation, run the GPSTk script. +If you prefer automation, run the build.sh script. Typical test build without install will look like this: - $ ./build.sh -bet + $ ./build.sh -et Typical test build with install will look like this: @@ -60,6 +58,10 @@ Typical test build with install will look like this: $ ./build.sh -et -i /tmp/test +To run a detailed test report after after build, install, and test: + + $ ./test-report.sh + UNIX-like Environment: Manual Build and Test: --------------------------------------------- @@ -91,6 +93,12 @@ To manually build and test the GPSTk, follow the following steps: $ ctest + 5. To run a test report: + + $ cd $gpstk_root + + $ ./test-report.sh + OSX and XCode: Testing Procedure: --------------------------------- @@ -111,6 +119,7 @@ Studio 2012 can be found at gpstk.org: http://www.gpstk.org/bin/view/Documentation/BuildingGPSTkUnderWindows + CTest Developer Testing Commands: --------------------------------- @@ -185,6 +194,7 @@ Current Test Structure * The main() portion of the code creates the test class object and executes its methods. It then tallies the number of failures and reports it to the screen/log. + ------------------------- Example Test File ------------------------- @@ -243,6 +253,7 @@ Example Test File { // If the creation of the Foo object did returns an error and it should not return an error, fail the assert with a false bit. + testFramework.assert( false, "Description that the constructor could not create the object properly", __LINE__ ); } diff --git a/build.sh b/build.sh index 5fc2fbdfc..f1e35b8b9 100755 --- a/build.sh +++ b/build.sh @@ -8,816 +8,242 @@ # Python bindings, and documentation. # # Help: -# $ ./build.sh -h +# $ build.sh -h # #---------------------------------------- #---------------------------------------- # Qué hora es? Dónde estamos? Y dónde vamos? #---------------------------------------- - -build_date=$(date +"%Y%m%d") -build_time=$(date +"%Y%m%d_%H%M%S") -build_host=$(hostname) -build_who=$(whoami) - -gpstk_root=$PWD -python_root=$gpstk_root/swig -python_exe=$(which python2.7) - -system_install_prefix=/usr/local -system_gpstk_install=/usr/local/gpstk -system_python_install=$(${python_exe} -c "import site; print(site.getsitepackages()[0])") # this will break for python < 2.7 -system_build_root=/tmp/gpstk_build_${build_who}_${build_host}_${build_date} - -user_install_prefix=$HOME/.local -user_gpstk_install=$HOME/.local/gpstk -user_python_install=$(${python_exe} -m site --user-site) -user_build_root=$gpstk_root/build -#---------------------------------------- -# Number of cores for use by compiler -# Default = all of them! -#---------------------------------------- +source $(dirname "$BASH_SOURCE")/build_setup.sh -case $(uname) in - Linux) - last_core_index=$(cat /proc/cpuinfo | grep "processor" | awk '{print $3}' | tail -1) - num_cores=$(($last_core_index + 1)) - ;; - Darwin) - num_cores=$(sysctl -n hw.ncpu) - ;; - *) - num_cores=1 -esac -num_threads=$num_cores - -#---------------------------------------- -# usage() function to use when help is needed: -#---------------------------------------- +user_install_prefix+="/gpstk" +system_install_prefix+="/gpstk" usage() { -cat << EOF - -purpose: This script automates and documents how to build, test, and install GPSTk with CMake. + cat << EOF +purpose: This script automates and documents how to build, test, and install the GPSTk. -usage: $0 [-bcdehptuvz] [-j ] [-i ] [-P ] +usage: $0 [opts] [-- cmake options...] - example: Typical admin build and install: $ ./build.sh -e - example: Typical user build and install: $ ./build.sh -eu - example: Typical test build and install: $ ./build.sh -et -i /tmp/test +examples: + $ build.sh # Just build software + $ sudo build.sh -s -b /tmp/qwe # Build and install core to $system_install_prefix + $ build.sh -tue # Build, test and install core, external, and python bindings to $gpstk OPTIONS: - -h help Show this message + -h Display this help message. - -b build_only Do not do an install. This is useful if you want to build as yourself, - and then later use sudo to do a system install. - Build path is constructed in this script. - Currently set to $system_build_root + -b Specify the cmake build directory to use. - -e build_ext GPSTk has two parts: core and ext. See README.txt for details. - Default (without -e) will build only $gpstk_root/core - Optional (with -e) will build both $gpstk_root/core and $gpstk_root/ext + -i Install the build to the given path. - -j num_threads Default = $num_threads, number of system cores determined from /proc/cpuinfo - for use with make, i.e. "make -j $num_threads" + -j Number of threads to have make use. Defauts to $num_threads + on this host. - -t test_switch Execute all CMake Ctest test cases before install. + -c Clean out any files in the build dir prior to running cmake. - -i install_prefix Default = $system_install_prefix, such that: - * C++ install path = $system_gpstk_install - * Python install path = $system_python_install - If you use a non-standard install path, you must update your environment. - For example, if your install_prefix=/tmp/test, do the following: - $ export LD_LIBRARY_PATH=/tmp/test/gpstk/lib:\$LD_LIBRARY_PATH - $ export PYTHONPATH=/tmp/test/lib/python2.7/site-packages:\$PYTHONPATH + -d Build documentation, including generate dependency graphs + using GraphViz (.DOT and .PDF files). - -u user_install Over-rides install prefix such that: - * C++ install path = $user_gpstk_install - * Python install path = $user_python_install - Also sets the build root to the following: - $user_build_root + -e GPSTk has several parts: core, ext, and python/swig bindings. + See README.txt for details. + Default (without -e) will build only core + Optional (with -e) will build core, ext, and swig - -g binary_tarball Packages binaries into gzip tarball + -u Install the build to the path in the \$gpstk environment variable. + If this variable is not set, it will be installed to + $user_install_prefix. - -s source_tarball Packages source release into gzip tarball + -s Install the build into $system_install_prefix and the python + bindings to the default system location. Make sure the build path + is writable by root. - -d build_docs Build, process, and install all documentation files. - * build Doxygen files (used for python docstrings) - * build Sphinx RST files into HTML documentation - * generate graphviz dependency graph (.DOT and .PDF files) + -x Disable building the python bindings. Default is to build them + if -e is specified. - -z build_sdist build source distribution for the python package and tar/zip it + -P Python executable used to help determine with python system libraries + will be used when building python extension package. + Default=$python_exe - -c clean Be very careful! Removes all files created from the build and install - Behaviour changes with install_prefix. Default with system install: - $ git clean -fxd $gpstk_root/swig/sphinx/ - $ rm -rf $build_root - $ rm -rf $system_gpstk_install - $ rm -rf $system_python_install/gpstk* + -t Build and run tests. - -p build_python Flag to build python extension package and set path to python intepreter - Default bit is build_python=0, but "-p" will set it to build_python=1 + -p Build supported packages (source, binary, deb, ...) - -P python_exe Python executable used to help determine with python system libraries - will be used when building python extension package. - Default=`which python`, full system path to python executable - If this flag is used, automatically turns on -p also, i.e. sets build_python=1 + -v Include debugging output. - -v verbosity Debug output +Notes: + Remember to add user and non-standard locations to your environment. Eg: + $ export LD_LIBRARY_PATH=/tmp/test/gpstk/lib:\$LD_LIBRARY_PATH + $ export PYTHONPATH=/tmp/test/lib/python2.7/site-packages:\$PYTHONPATH EOF - -exit 1 } -#---------------------------------------- -# Parse input args -#---------------------------------------- -while getopts "bcdeghi:j:P:pstuvz" OPTION -do +while getopts "hb:cdepi:j:xP:sutv" OPTION; do case $OPTION in - b) build_only=1;; - c) clean=1;; - d) build_docs=1;; - e) build_ext=1;; - g) binary_tarball=1;; - h) usage;; - i) install_prefix="$OPTARG";; - j) num_threads="$OPTARG";; - p) build_python=1;; - P) build_python=1 - python_exe="$OPTARG" - ;; - s) source_tarball=1;; - t) test_switch=1;; - u) user_install=1;; - v) verbosity=1;; - z) build_sdist=1;; - *) echo "Invalid option: -$OPTARG" >&2 - usage - exit 2 - ;; + h) usage + exit 0 + ;; + b) build_root=$(abspath ${OPTARG}) + ;; + c) clean=1 + ;; + d) build_docs=1 + ;; + e) build_ext=1 + build_python=1 + ;; + p) build_packages=1 + ;; + i) install=1 + install_prefix=$(abspath ${OPTARG}) + ;; + j) num_threads=$OPTARG + ;; + x) exclude_python=1 + ;; + P) python_exe=$OPTARG + ;; + u) install=1 + install_prefix=${gpstk:-$user_install_prefix} + python_install=$user_python_install + ;; + s) install=1 + install_prefix=$system_install_prefix + python_install=$system_python_install + ;; + t) test_switch=1 + ;; + v) verbose=1 + ;; + *) echo "Invalid option: -$OPTARG" >&2 + usage + exit 2 + ;; esac done -# Shift OPTIND so that if there are any additional -# command line options we did not capture, -# then they are accessible via use of $* -shift $(($OPTIND - 1)) - -#---------------------------------------- -# Install Paths -#---------------------------------------- - -if [[ -z "$install_prefix" ]]; then - - if [ "$user_install" ]; then - install_prefix=$user_install_prefix - gpstk_install=$user_gpstk_install - build_root=$user_build_root - else - install_prefix=$system_install_prefix - gpstk_install=$system_gpstk_install - build_root=$system_build_root - fi - -else - - gpstk_install=${install_prefix} - build_root=$system_build_root - -fi - -# the python install is ALWAYS in the install_prefix -# to insure, in the case of the default(system) install and the use install, -# that the pyhton package is installed to a place that is already in sys.path -# and to further insure that if the user selects a crazy non-standard install path, -# that the python stuff gets shoved into the same crazy place as the gpstk cpp junk -if [ "$build_python" ]; then - python_install=${install_prefix} -else - python_install= -fi - -#---------------------------------------- -# Echo configuration -#---------------------------------------- - -echo "" -echo "" -echo "============================================================" -echo "GPSTk Build and Test Script: Echo of config values..." -echo "============================================================" -echo "" -echo "$0: system user = $build_who" -echo "$0: system name = $build_host" -echo "$0: system time = $build_time" -echo "" - -# helper function: Print True Or False -function ptof { - if [ -z $1 ]; then printf "False"; - else printf "True"; - fi -} -printf "$0: gpstk_root = $gpstk_root\n" -printf "$0: install_prefix = $install_prefix\n" -printf "$0: gpstk_install = $gpstk_install\n" -printf "$0: build_python = $(ptof $build_python)\n" -printf "$0: python_exe = $python_exe\n" -printf "$0: python_install = $python_install\n" -printf "$0: user_install = $(ptof $user_install)\n" -printf "$0: clean = $(ptof $clean)\n" -printf "$0: build_root = $build_root\n" -printf "$0: num_cores = $num_cores\n" -printf "$0: num_threads = $num_threads\n" -printf "$0: build_ext = $(ptof $build_ext)\n" -printf "$0: test_switch = $(ptof $test_switch)\n" -printf "$0: verbosity = $(ptof $verbosity)\n" -printf "$0: build_docs = $(ptof $build_docs)\n" -printf "$0: build_sdist = $(ptof $build_sdist)\n" - -if [ ! -d "$gpstk_root" ]; then - echo "$0: Configuration: ERROR: $gpstk_root does not exist." - exit 1 -fi - -echo "" -echo "============================================================" -echo "" - -#---------------------------------------- -# Test for source files, exit if nothing to build -#---------------------------------------- - -num_files_ext=0 -num_files_core=0 - -if [ "$build_ext" ]; then - num_files_ext=$(find $gpstk_root/ext/lib/ -type f -name "*.cpp" | wc -l) - if [ "$num_files_ext" -eq 0 ]; then - echo "$0: ERROR: $gpstk_root/ext/lib contains no *.cpp source files. Try building without /ext. See help: $0 -h" - exit 1 - fi -else - num_files_core=$(find $gpstk_root/core/lib/ -type f -name "*.cpp" | wc -l) - if [ "$num_files_core" -eq 0 ]; then - echo "$0: ERROR: $gpstk_root/core/lib contains no *.cpp source files. Try building /ext. See help: $0 -h" - exit 1 - fi -fi - -#---------------------------------------- -# Clean build and install directories -#---------------------------------------- - -if [ "$clean" ]; then - echo "" - echo "" - echo "$0: Clean: Removing previous c++ and python build" - echo "" - echo "" - - git clean -fxd $gpstk_root/swig/sphinx/ - rm -rf $build_root +shift $(($OPTIND - 1)) +LOG=$build_root/build.log - if [ ! $build_only ]; then - rm -rf $gpstk_install/*; - rm -rf $python_install/gpstk* - fi -fi #---------------------------------------- -# Try to create the build and install paths +# Clean build directory #---------------------------------------- - if [ ! -d "$build_root" ]; then - echo "$0: NOTICE: build path $build_root does not exist. Creating it now." - mkdir -p $build_root - if [ ! -d "$build_root" ]; then - echo "$0: ERROR: Unable to create the GPSTk build directory $build_root" - exit 1 - fi -fi + mkdir -p "$build_root" +fi + +if [ $clean ]; then + rm -rf $build_root/* + log "Cleaned out $build_root ..." +fi + +log "============================================================" +log "GPSTk build config ..." +log "repo = $repo" +log "build_root = $build_root" +log "install = $(ptof $install)" +log "install_prefix = $install_prefix" +log "build_ext = $(ptof $build_ext)" +log "exclude_python = $(ptof $exclude_python)" +log "python_install = $python_install" +log "python_exe = $python_exe" +log "build_docs = $(ptof $build_docs)" +log "build_packages = $(ptof $build_packages)" +log "test_switch = $(ptof $test_switch)" +log "clean = $(ptof $clean)" +log "verbose = $(ptof $verbose)" +log "num_threads = $num_threads" +log "cmake args = $@" +log "time =" `date` +log "hostname =" $hostname +log "uname =" `uname -a` +log "git branch =" $git_branch +log "logfile =" $LOG +log -if [[ -z "$build_only" ]]; then - # only test if user did NOT chose to build_only - if [ ! -d "$gpstk_install" ]; then - echo "$0: WARNING: install path $gpstk_install does not exist. Creating it now." - mkdir -p $gpstk_install - if [ ! -d "$gpstk_install" ]; then - echo "$0: ERROR: Unable to create the GPSTk C++ lib install directory $gpstk_install" - exit 1 - fi - fi -fi - -if [ "$build_python" ]; then - if [ ! -d "$python_install" ]; then - echo "$0: WARNING: Install path $python_install does not exist. Creating it now." - mkdir -p $python_install - if [ ! -d "$python_install" ]; then - echo "$0: ERROR: Unable to create the GPSTk Python package install directory $python_install" - exit 1 - fi - fi -fi -#---------------------------------------- -# Pre-Build Documentation processing -#---------------------------------------- +cd $build_root -if [ "$build_docs" ]; then - - echo "" - echo "" - echo "$0: Documentation: processing dOxygen XML and docstrings and Sphinx RST ..." - echo "" - echo "" - - # build doxygen xml output from scraping the source files *.cpp and *.hpp - if [ -d "$gpstk_root/doc" ]; then - echo "$0: Documentation: Doxygen: Using existing doxygen files." - else - echo "$0: Documentation: Doxygen: Generating XML files and dot graphs for C++ library... $gpstk_rooot/doc/xml" - cd $gpstk_root - # Running doxygen walks the C++ source files and scrapes doxygen comments and - # writes out $gpstk_root/doc/html/*.html and $gpstk_root/doc/xml/*.xml - # and generates graphviz files (.map, .md5, and .png) in $gpstk_root/doc/html/ - doxygen - tar -czvf $gpstk_root/gpstk_doc_cpp.tgz -C $gpstk_root/doc/html . - # doc_install_prefix=/usr/share/gpstk - # mkdir -p $doc_install_prefix/cpp/html - # tar -xzvf gpstk_doc_cpp.tgz -C $doc_install_prefix/cpp/html +if [ $build_docs ]; then + log "Pre-build documentation processing ..." + # Dynamically configure the Doxyfile with the source and destination paths + sources="$repo/core/lib" + if [ $build_ext ]; then + sources+=" $repo/ext/lib" fi - - # generate python files.i docstrings from doxygen xml output - if [ "$build_python" ]; then - if [ -d "$python_root/doc" ]; then - echo "$0: Documentation: Docstrings: Using existing docstring files." - else - echo "$0: Documentation: Docstrings: using Doxygen XML output to generate docstring .i files for python bindings... $python_root/doc " - cd $python_root - # running docstring_generator.py reads in the $gpstk_root/doc/xml/*.xml - # fileswere created previously by doxygen and then - # outputs SWIG .i files to $python_root/doc - ${python_exe} docstring_generator.py - fi + log "Generating dOxygen files from C/C++ source ..." + sed -e "s#gpstk_sources#$sources#g" -e "s#gpstk_doc_dir#$build_root/doc#g" $repo/Doxyfile | doxygen - >$build_root/dOxygen.log + tar -czf gpstk_doc_cpp.tgz -C doc/html . + + if [[ -z $exclude_python && $build_ext ]] ; then + log "Generating swig/python doc files from dOxygen output ..." + ${python_exe} $repo/swig/docstring_generator.py $build_root/doc $build_root/swig/doc >$build_root/swig_doc.log fi - - # make path for graphviz - path_graphviz=$build_root/doc/graphviz - mkdir -p $path_graphviz - fi -#---------------------------------------- -# CMake generation of Makefiles -#---------------------------------------- - -echo "" -echo "" -echo "$0: CMake: executing cmake command to generate Makefiles..." -echo "" -echo "" - -args="" -args+=${gpstk_install:+" -DCMAKE_INSTALL_PREFIX=$gpstk_install"} -args+=${build_python:+" -DBUILD_PYTHON=ON"} -if [ "$build_python" ]; then +# setup the cmake command +args=$@ +if [ $exclude_python ]; then + args+=" -DBUILD_PYTHON=OFF" +elif [ $build_ext ]; then + args+=" -DBUILD_PYTHON=ON" args+=${python_exe:+" -DPYTHON_EXECUTABLE=$python_exe"} - args+=${install_prefix:+" -DPYTHON_INSTALL_PREFIX=$python_install"} + args+=${python_install:+" -DPYTHON_INSTALL_PREFIX=$python_install"} fi +args+=${install_prefix:+" -DCMAKE_INSTALL_PREFIX=$install_prefix"} args+=${build_ext:+" -DBUILD_EXT=ON"} +args+=${verbose:+" -DDEBUG_SWITCH=ON"} args+=${test_switch:+" -DTEST_SWITCH=ON"} -args+=${verbosity:+" -DDEBUG_SWITCH=ON"} -args+=${build_docs:+" --graphviz=$path_graphviz/gpstk_graphviz.dot"} +args+=${build_docs:+" --graphviz=$build_root/doc/graphviz/gpstk_graphviz.dot"} -# args+="-C $gpstk_root/BuildSetup.cmake" +exit_on_fail=1 -cd $build_root -CMAKE_OUTPUT_LOG=$build_root/cmake.log -cmake $args $gpstk_root 2>&1 | tee -a $CMAKE_OUTPUT_LOG +run cmake $args $repo -#---------------------------------------- -# Build -#---------------------------------------- +run make all -j $num_threads -echo "" -echo "" -if [ "$build_python" ]; then - echo "$0: Make: Building the following: C++ libs, C++ apps, and Python extension package" -else - echo "$0: Make: Building the following: C++ libs, C++ apps" +exit_on_fail=0 +if [ $test_switch ]; then + run ctest -v -j $num_threads + log "See $build_root/Testing/Temporary/LastTest.log for detailed results" fi -echo "" -echo "" - -cd $build_root -MAKE_OUTPUT_LOG=$build_root/build.log -make -j $num_threads 2>&1 | tee -a $MAKE_OUTPUT_LOG - -#---------------------------------------- -# Test: Hooks for test framework -#---------------------------------------- - -if [ "$test_switch" ]; then - - # run the tests - echo "" - echo "------------------------------------------------------------" - echo "Tests: started" - echo "------------------------------------------------------------" - echo "" - - cd $build_root - ctest -v - - echo "" - echo "------------------------------------------------------------" - echo "Tests: completed" - echo "------------------------------------------------------------" - echo "" - - #---------------------------------------- - # capture the test output - #---------------------------------------- - - ctest_keyword=GpstkTest - ctest_log_raw=$build_root/Testing/Temporary/LastTest.log - ctest_log_save=$build_root/test.log - cat $ctest_log_raw | grep "$ctest_keyword" > $ctest_log_save - - #---------------------------------------- - # summary results - #---------------------------------------- - - test_count=$(cat $ctest_log_save | wc -l) - tests_passed=$(cat $ctest_log_save | grep "failBit=0" | wc -l) - tests_failed=$(cat $ctest_log_save | grep "failBit=1" | wc -l) - - echo "" - echo "------------------------------------------------------------" - echo "Tests: Summary Results" - echo "------------------------------------------------------------" - echo "Number of tests run = $test_count" - echo "Number of tests passed = $tests_passed" - echo "Number of tests failed = $tests_failed" - echo "------------------------------------------------------------" - echo "" - - #---------------------------------------- - # Search test.log for keywords, summarize - #---------------------------------------- - - keyword_list=() - keyword_list+=("AlmOrbit") - keyword_list+=("ANSITime") - keyword_list+=("Binex_Attrs") - keyword_list+=("Binex_ReadWrite") - keyword_list+=("Binex_Types") - keyword_list+=("Binex_UpdateExtract") - keyword_list+=("BinUtils") - keyword_list+=("BivarStats") - keyword_list+=("CivilTime") - keyword_list+=("ClockModel") - keyword_list+=("CommonTime") - keyword_list+=("Convhelp") - keyword_list+=("FileFilter") - keyword_list+=("FileHunter") - keyword_list+=("FileSpec") - keyword_list+=("FileStore") - keyword_list+=("FileUtils") - keyword_list+=("GPSWeekSecond") - keyword_list+=("GPSWeekZcount") - keyword_list+=("GPSZcount") - keyword_list+=("HelmertTransform") - keyword_list+=("IonoModel") - keyword_list+=("JulianDate") - keyword_list+=("Matrix") - keyword_list+=("MJD") - keyword_list+=("ObsID") - keyword_list+=("PolyFit") - keyword_list+=("Position") - keyword_list+=("RACRotation") - keyword_list+=("ReferenceFrame") - keyword_list+=("RinexEph") - keyword_list+=("RinexMet") - keyword_list+=("RinexNav") - keyword_list+=("RinexObs") - keyword_list+=("Rinex_T") - keyword_list+=("SatID") - keyword_list+=("Sinex_ReadWrite") - keyword_list+=("SP3Eph") - keyword_list+=("SP3SatID") - keyword_list+=("Stats") - keyword_list+=("Stl_helpers") - keyword_list+=("StringUtils") - keyword_list+=("SystemTime") - keyword_list+=("TimeConverters") - keyword_list+=("TimeRange") - keyword_list+=("TimeString") - keyword_list+=("TimeSystem") - keyword_list+=("TimeTag") - keyword_list+=("Triple") - keyword_list+=("UnixTime") - keyword_list+=("ValidType") - keyword_list+=("Vector") - keyword_list+=("WxObsMap") - keyword_list+=("Xvt") - keyword_list+=("YDSTime") - - - myheader="%-16s, %4s, %4s, %4s, %5s\n" - myformat="%-16s, %4d, %4d, %4d, %5.1f \n" - mydivider="=========================================" - - - # myformat="name = %-16s, tests run = %4d, passed = %4d, failed = %4d, %%passed = %5.1f \n" - - echo "------------------------------------------------------------" - echo "Tests: Results by Category" - echo "------------------------------------------------------------" - - echo "" - printf "$myheader" "NAME" "RUN" "PASS" "FAIL" "%PASS" - printf "%s\n" "$mydivider" - - for keyword in "${keyword_list[@]}"; do - - tests_run=$(cat $ctest_log_save | grep -i "$keyword" | wc -l) - tests_passed=$(cat $ctest_log_save | grep -i "$keyword" | grep "failBit=0" | wc -l) - tests_failed=$(cat $ctest_log_save | grep -i "$keyword" | grep "failBit=1" | wc -l) - percent_pass=$(awk -v r=$tests_run -v p=$tests_passed 'BEGIN { print (100*(p/r)) }') - - printf "$myformat" "$keyword" "$tests_run" "$tests_passed" "$tests_failed" "$percent_pass" - - done - echo "" - echo "------------------------------------------------------------" - echo "" +if [ $install ]; then + run make install -j $num_threads fi -#---------------------------------------- -# Post-Build Documentation processing -#---------------------------------------- - -if [ "$build_docs" ]; then - - echo "" - echo "" - echo "$0: Post-build Documentation: generating HTML documentation for python bindings from RST files using Sphinx ..." - echo "" - echo "" - - # Building sphinx RST documentation - # Requires the import of the gpstk python package, so you have to do this AFTER building the bindings - # After importing gpstk, sphinx generates *.rst files for each attibute in the gpstk namespace, and - # then converts those to html files. - if [ "$build_python" ]; then - command -v sphinx-build 1>/dev/null 2>/dev/null # exit status 0 indicated program exists - if [[ $? -eq 0 ]] ; then - echo "$0: Documentation: Sphinx: Rebuilding RST documentation now..." - cd $python_root/sphinx - # running make html generates a lot of new RST files in $python_root/sphinx/*.rst - # and a bunch of html files under $python_root/sphinx/_build/html/*.html - make html - tar -czvf $gpstk_root/gpstk_doc_python.tgz -C $python_root/sphinx/_build/html/ . - # doc_install_prefix=/usr/share/gpstk - # mkdir -p $doc_install_prefix/python/html - # tar -xzvf gpstk_doc_python.tgz -C $doc_install_prefix/python/html - - - # doc_install=/usr/share/gpstk/doc - # mkdir -p $doc_install/python - # tar -xzvf gpstk_doc_python.tgz -C $doc_install/python/ - - else - echo "$0: Documentation: Cannot build Sphinx Documentation." - fi - fi - - echo "" - echo "" - echo "$0: Post-build Documentation: processing Graphviz ..." - echo "" - echo "" - - # Building Graphviz .DOT and .PDF - command -v dot 1>/dev/null 2>/dev/null # exit status 0 indicated program exists - if [[ $? -eq 0 ]] ; then - echo "$0: Documentation: Graphviz: Generating GraphViz output PDF... $path_graphviz" - dot -Tpdf $path_graphviz/gpstk_graphviz.dot -o $path_graphviz/gpstk_graphviz.pdf - else - echo "$0: Documentation: Cannot build Graphviz documentation." - fi +if [ $build_docs ]; then + log "Post-build documentation processing ..." + # This is commented out because the RST documentation polutes the repo at the moment + # This process needs to be re-factored to use the CMAKE_CURRENT_BINARY_DIR +# if [[ -z $exclude_python && $build_ext ]] ; then +# log "Building RST documentation with Sphinx ..." +# cd $repo/swig/sphinx +# make html +# tar -czf $build_root/gpstk_doc_python.tgz -C $repo/swig/sphinx/_build/html/ . +# fi + log "Generating GraphViz output PDF ..." + dot -Tpdf $build_root/doc/graphviz/gpstk_graphviz.dot -o $build_root/doc/graphviz/gpstk_graphviz.pdf fi -#---------------------------------------- -# Python source distribution -#---------------------------------------- -# default: tar-ball, zip -# optional: debian, set package_debian=1 to build it. - -if [ "$build_python" ]; then - if [ $build_sdist ]; then - - echo "" - echo "" - echo "$0: Distribution: Generating distribution packages..." - echo "" - echo "" - cd $python_root/install_package +if [ $build_packages ]; then + run make package + run make package_source + + if [[ -z $exclude_python && $build_ext ]] ; then + cd $build_root/swig/install_package ${python_exe} setup.py sdist --formats=zip,gztar - - package_debian=0 - if [ $package_debian = 1 ]; then - # py2dsc will convert a distutils-built source tarball into a Debian source package. - # py2dsc is not typically installed, so we need to add a check before trying to run it. - command -v py2dsc 1>/dev/null 2>/dev/null # exit status 0 indicated program exists - if [[ $? -eq 0 ]] ; then - cd $python_root/install_package/dist - py2dsc gpstk-2.5.tar.gz - cd $python_root/install_package/dist/deb_dist/gpstk-2.5/ - dpkg-buildpackage -rfakeroot -uc -us - fi - fi fi fi -#---------------------------------------- -# Install -#---------------------------------------- - -if [ $build_only ]; then - echo "" - echo "" - echo "$0: Install: Build script was configured to do a build only" - echo "$0: Install: Exiting now..." - echo "" - echo "" - exit 1 -else - cd $build_root - INSTALL_OUTPUT_LOG=$build_root/install.log - make install -j $num_threads 2>&1 | tee -a $INSTALL_OUTPUT_LOG -fi - -#---------------------------------------- -# Package -#---------------------------------------- - - -if [ "$binary_tarball" ]; then - echo "" - echo "" - echo "$0: Binary Tarball: Generating gzip tarball of binaries ..." - echo "" - echo "" - make package -fi - - -if [ "$source_tarball" ]; then - echo "" - echo "" - echo "$0: Source Release Tarball: Generating gzip tarball of source ..." - echo "" - echo "" - make package_source -fi - - - -#---------------------------------------- -# Test Shell Environment, PATH, LD_LIBRARY_PATH -#---------------------------------------- - -# Test whether $gpstk_install is in the user's PATH -# If not, echo a warning since the python extension -# module will break at run time. - -echo "" -echo "" -echo "$0: Paths: Testing library load paths..." -echo "" -echo "" - -ldd_path_list=$(ldconfig -v 2>/dev/null | grep -v ^$'\t' | sed -e 's/://g') -ld_lib_path_list=$(echo $LD_LIBRARY_PATH) -gpstk_install_path_test=$(echo "$ldd_path_list $ld_lib_path_list" | grep -o "$gpstk_install") - -if [ -z "$gpstk_install_path_test" ]; then - - echo "" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | [FAIL]: Post-install config test: Can $gpstk_install/lib be found by ldd?" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | " - echo "$0: Paths: | Based on a query to ldconfig, it appears that your" - echo "$0: Paths: | GPSTk library install path is NOT in a location known to ldd" - echo "$0: Paths: | Anything trying to link against libgpstk.so will fail" - echo "$0: Paths: | including the GPSTk python bindings." - echo "$0: Paths: | " - echo "$0: Paths: | What should be found:" - echo "$0: Paths: | gpstk_install_path = $gpstk_install" - echo "$0: Paths: | gpstk_lib_install_path = $gpstk_install/lib" - echo "$0: Paths: | " - echo "$0: Paths: | Where they should be found:" - echo "$0: Paths: | ldd_path_list:" - for ldd_path_entry in $ldd_path_list; do - echo "$0: Paths: | ldd_path_entry = $ldd_path_entry" - done; - echo "$0: Paths: | " - echo "$0: Paths: | ld_lib_path_list:" - for ld_lib_path_entry in $ld_lib_path_list; do - echo "$0: Paths: | ld_lib_path_entry = $ld_lib_path_entry" - done; - echo "$0: Paths: | " - echo "$0: Paths: | Recommendation: update your environment as follows:" - echo "$0: Paths: | " - echo "$0: Paths: | $ export LD_LIBRARY_PATH=$gpstk_install/lib:\$LD_LIBRARY_PATH " - echo "$0: Paths: | " - echo "$0: Paths: |------------------------------------------ " - echo "" -else - echo "" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | [PASS]: Post-install config test: Can $gpstk_install/lib be found by ldd?" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | GPSTk library install path appears to be in your PATH" - echo "$0: Paths: | No further action needed." - echo "$0: Paths: |------------------------------------------ " - echo "" -fi - -#---------------------------------------- -# Test Python Module search path, sys.path -#---------------------------------------- - -if [ "$build_python" ]; then - - # get the contents of sys.path, the python module search path - sys_path_raw=$($python_exe -c 'import sys;print(sys.path)') - - # filter the square brackets, commas, and quotes and put one path on each line - sys_path_list=$(echo $sys_path_raw | sed 's/\(\[\|\]\)//g' | sed "s/'//g" | sed -e 's/,/ /g') - - # test the sys_path_list to see if it contains the path where this script installed GPSTk python module - sys_path_test=$(echo "$sys_path_list" | grep -o "$python_install") - - # if the path is in sys.path, then sys_path_test will NOT be empty - if [ -z "$sys_path_test" ]; then - - echo "" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | [FAIL]: Post-install config test: Can $python_install be found by sys.path?" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | " - echo "$0: Paths: | Based on a query to $python_exe and sys.path, your " - echo "$0: Paths: | GPSTk python package install path is not known to sys.path" - echo "$0: Paths: | Any attempt to 'import gpstk' will fail" - echo "$0: Paths: | " - echo "$0: Paths: | What should be found:" - echo "$0: Paths: | python_install_path = $python_install" - echo "$0: Paths: | " - echo "$0: Paths: | Where it should be found:" - echo "$0: Paths: | sys_path_list:" - for sys_path_entry in $sys_path_list; do - echo "$0: Paths: | sys_path_entry = $sys_path_entry" - done; - echo "$0: Paths: | " - echo "$0: Paths: | Recommendation: update your environment as follows:" - echo "$0: Paths: | " - echo "$0: Paths: | $ export PYTHONPATH=$install_prefix/lib/python2.7/site-packages:\$PYTHONPATH " - echo "$0: Paths: | " - echo "$0: Paths: |------------------------------------------ " - echo "" - - else - echo "" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | [PASS]: Post-install config test: Can $python_install be found by sys.path?" - echo "$0: Paths: |------------------------------------------ " - echo "$0: Paths: | Based on a query to $python_exe and sys.path, your " - echo "$0: Paths: | GPSTk python package install path is known to sys.path" - echo "$0: Paths: | GPSTk python package 'import gpstk' should work just fine." - echo "$0: Paths: | No further action needed." - echo "$0: Paths: |------------------------------------------ " - echo "" - - fi - -fi -#---------------------------------------- -# The End -#---------------------------------------- -echo "" -echo "" +log +log "GPSTk build done. :-)" +log `date` diff --git a/build_setup.sh b/build_setup.sh new file mode 100644 index 000000000..a70135574 --- /dev/null +++ b/build_setup.sh @@ -0,0 +1,94 @@ +#!/bin/bash +#---------------------------------------- +# +# Purpose: routines used by build.sh to set up the environment + +# The log file $LOG should go in the build directory. This can be +# reassigned after the command line argumens have been parsed. Also +# that dir can be clean out if the -c option is given. +# Don't call this function until after the above is done. +function log +{ + echo "$@" | tee -a $LOG +} + +function run +{ + log "========================================" + log "$@" + if [ $verbose ]; then + "$@" 2>&1 | tee -a $LOG + else + "$@" 2>&1 >> $LOG + fi + rc=${PIPESTATUS[0]} + if [[ $rc != 0 ]]; then + log "Error, rc=$rc" + if [ $exit_on_fail == 1 ]; then + exit + fi + fi + return $rc +} + +# helper function: Print True Or False +function ptof { + if [[ -z $1 ]]; then printf "False"; + else printf "True"; + fi +} + +abspath() +{ + cd "$(dirname "$1")" + printf "%s/%s\n" "$(pwd)" "$(basename "$1")" + cd "$OLDPWD" +} + +absdir() +{ + cd $1 + pwd + cd $OLDPATH +} + +#---------------------------------------- +# Determine number of cores for compiling. +#---------------------------------------- +case `uname` in + Linux) + last_core_index=`cat /proc/cpuinfo | grep "processor" | awk '{print $3}' | tail -1` + num_cores=`nproc` + hostname=$(hostname -s) + ;; + Darwin) + num_cores=`sysctl -n hw.ncpu` + hostname=$(hostname -s) + ;; + SunOS) + num_cores=`kstat cpu_info | grep instance | wc -l` + hostname=$(uname -n) + ;; + *) + num_cores=1 +esac + +if ((num_cores<16)); then + num_threads=$((num_cores/2)) +else + num_threads=$((num_cores*3/4)) +fi + +repo=$(absdir $(dirname $0)) + +user_install_prefix=$HOME/.local +system_install_prefix=/usr/local + +python_exe=`which python2.7` + +system_python_install="/usr/local" +user_python_install="~/.local" + +git_branch=`cd $repo; git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` + +build_root=$repo/build-$hostname-$git_branch diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake deleted file mode 100755 index 378f9e8e6..000000000 --- a/cmake/Modules/FindCppUnit.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Find the CppUnit includes and library -# -# This module defines -# CPPUNIT_INCLUDE_DIRS, where to find tiff.h, etc. -# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. -# CPPUNIT_FOUND, If false, do not try to use CppUnit. - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(CPPUNIT "cppunit") -IF(NOT CPPUNIT_FOUND) - -FIND_PATH(CPPUNIT_INCLUDE_DIRS cppunit/TestCase.h - /usr/local/include - /usr/include -) - -FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit - ${CPPUNIT_INCLUDE_DIRS}/../lib - /usr/local/lib - /usr/lib) - -IF(CPPUNIT_INCLUDE_DIRS) - IF(CPPUNIT_LIBRARIES) - SET(CPPUNIT_FOUND "YES") - SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} ${CMAKE_DL_LIBS}) - ENDIF(CPPUNIT_LIBRARIES) -ENDIF(CPPUNIT_INCLUDE_DIRS) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) -ENDIF(NOT CPPUNIT_FOUND) \ No newline at end of file diff --git a/cmake/Modules/FindGPSTK.cmake b/cmake/Modules/FindGPSTK.cmake deleted file mode 100755 index d8cddfa9f..000000000 --- a/cmake/Modules/FindGPSTK.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# Find GPSTK -# -# Find the native GPSTK includes and library. -# Currently just hard-coded paths -# -# GPSTK_INCLUDE_DIRS - where to find GPSTK files.hpp, etc. -# GPSTK_LIBRARIES - List of libraries when using GPSTK. -# GPSTK_FOUND - True if GPSTK was "found". So, always true. -# -#============================================================================= - -if( DEFINED ENV{gpstk} ) - message(STATUS "Using GPSTK defined by environment variable $ENV{gpstk}..." ) - set( GPSTK_FOUND TRUE ) - set( GPSTK_INSTALL $ENV{gpstk} ) - set( GPSTK_INCLUDE_DIRS ${GPSTK_INSTALL}/include ) - set( GPSTK_LIBRARIES ${GPSTK_INSTALL}/lib/libgpstk.so ) - set( GPSTK_LIBRARY_DIRS ${GPSTK_INSTALL}/lib ) - set( GPSTK_SO_VERSION 23 ) -elseif( DEFINED GPSTK_INSTALL ) - message(STATUS "Using GPSTK defined by CMake variable ${GPSTK_INSTALL}..." ) - set( GPSTK_FOUND TRUE ) - set( GPSTK_INCLUDE_DIRS ${GPSTK_INSTALL}/include ) - set( GPSTK_LIBRARIES ${GPSTK_INSTALL}/lib/libgpstk.so ) - set( GPSTK_LIBRARY_DIRS ${GPSTK_INSTALL}/lib ) - set( GPSTK_SO_VERSION 23 ) -else( ) - set( GPSTK_FOUND FALSE ) - message(WARNING "The GPSTK install path is not defined.") - message(WARNING "You must tell CMake the full path to your GPSTk install." ) - message(WARNING " Option 1: Define an environment variable gpstk." ) - message(WARNING " Example: $ export gpstk=~/git/gpstk/dev/install " ) - message(WARNING " Option 2: Define a CMake variable GPSTK_INSTALL." ) - message(WARNING " Example: $ cmake -DGPSTK_INSTALL=~/git/gpstk/dev/install " ) - return( ) -endif( ) -return( ) - diff --git a/core/lib/CommandLine/CommandLine.cpp b/core/lib/CommandLine/CommandLine.cpp index 14ccf4771..0eb5fd637 100644 --- a/core/lib/CommandLine/CommandLine.cpp +++ b/core/lib/CommandLine/CommandLine.cpp @@ -160,7 +160,7 @@ try { } // end try catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -272,7 +272,7 @@ try { } // end try catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -362,7 +362,7 @@ try { } // end try catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -454,7 +454,7 @@ try { } // end try catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -674,7 +674,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -709,7 +709,7 @@ try { } // end for } // end try catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -725,9 +725,9 @@ try { // parse args, saving values ----------------------- i = 0; while(i < Args.size()) { + arg = Args[i]; // arg // does it match an option? for(j=0; j order.size())) + return 0; + + if (idx == (unsigned long)-1) + return order[order.size()-1]; + + return order[idx]; + } + // writes out the vector of values for this command option std::ostream& CommandOption::dumpValue(std::ostream& out) const { @@ -199,6 +211,28 @@ namespace gpstk return string(); } + string CommandOptionWithDecimalArg::checkArguments() + { + string errstr = CommandOption::checkArguments(); + + if (!errstr.empty()) + return errstr; + + vector::size_type vecindex; + for(vecindex = 0; vecindex < value.size(); vecindex++) + { + if (!isDecimalString(value[vecindex])) + { + string errstr("Argument for "); + errstr += getOptionString(); + errstr += string(" should be a decimal string."); + return errstr; + } + } + + return string(); + } + string CommandOptionWithStringArg::checkArguments() { string errstr = CommandOption::checkArguments(); @@ -257,6 +291,50 @@ namespace gpstk return string(); } + string CommandOptionNOf::checkArguments() + { + // n-of doesn't call CommandOption::checkArguments because + // it doesn't use "required" + string fewerrstr("At least " + StringUtils::asString(N)); + + string manyerrstr("No more than " + StringUtils::asString(maxCount)); + string errstr(" of the following options must be specified: "); + + bool found = false; + unsigned long n = 0; + + for (CommandOptionVec::size_type i = 0; i < optionVec.size(); i++) + { + n += optionVec[i]->getCount(); + if (i > 0) + errstr += ", "; + errstr += optionVec[i]->getOptionString(); + } + + if (n < N) + return fewerrstr + errstr; + if (n > maxCount) + return manyerrstr + errstr; + + return string(); + } + + std::vector CommandOptionNOf::which() const + { + std::vector rv; + + for (CommandOptionVec::size_type i = 0; i < optionVec.size(); i++) + { + if (optionVec[i]->getCount()) + { + rv.push_back(optionVec[i]); + break; + } + } + + return rv; + } + string CommandOptionOneOf::checkArguments() { // one-of doesn't call CommandOption::checkArguments because diff --git a/core/lib/CommandLine/CommandOption.hpp b/core/lib/CommandLine/CommandOption.hpp index 154287c34..cc9ea817e 100644 --- a/core/lib/CommandLine/CommandOption.hpp +++ b/core/lib/CommandLine/CommandOption.hpp @@ -187,11 +187,20 @@ namespace gpstk */ std::vector getValue() const { return value; } - /// Returns the order which this command option was seen on the - /// command line, with 1 being the first option. - // If it can be repeated, this order represents the order of - /// the last occurance of this option. - unsigned int getOrder() const { return order; } + /** Returns the order which this command option was seen on + * the command line, with 1 being the first option. If it + * can be repeated and idx is unspecified, this order + * represents the order of the last occurance of this + * option. + * + * @param idx the index of the instance of this command + * option to get the order of. This is used when the command + * option can appear multiple times, and idx is the same + * index as in the vector of values. The first instance of + * this command option will be index 0, and so on. If \a idx + * is invalid (i.e. it does not exist in the vector), a zero + * is returned. */ + unsigned long getOrder(unsigned long idx = -1) const; /// Displays this->value to the stream \c out. std::ostream& dumpValue(std::ostream& out) const; @@ -235,7 +244,7 @@ namespace gpstk /// If it's 0, then it's unlimited. unsigned long maxCount; /// The order in which this option was encountered on the command line - unsigned long order; + std::vector order; /// Default Constructor CommandOption() {} @@ -351,7 +360,7 @@ namespace gpstk CommandOptionWithStringArg() {} }; - /// A CommandOption that requires a numeric argument. + /// A CommandOption that requires a non-negative integer numeric argument. class CommandOptionWithNumberArg : public CommandOptionWithArg { public: @@ -377,6 +386,32 @@ namespace gpstk CommandOptionWithNumberArg() {} }; + /// A CommandOption that requires a fixed-point decimal numeric argument. + class CommandOptionWithDecimalArg : public CommandOptionWithArg + { + public: + /// Constructor + CommandOptionWithDecimalArg(const char shOpt, + const std::string& loOpt, + const std::string& desc, + const bool required = false) + : CommandOptionWithArg(stdType, shOpt, loOpt, desc, required) + {} + + /// Destructor + virtual ~CommandOptionWithDecimalArg() {} + + virtual std::string checkArguments(); + + /// Returns a string with the argument format. + virtual std::string getArgString() const + { return "DEC"; } + + protected: + /// Default Constructor + CommandOptionWithDecimalArg() {} + }; + /** * It only makes sense to have a single one of these set. It is * the option that takes the rest of the command line options @@ -411,6 +446,56 @@ namespace gpstk CommandOptionRest() {} }; + /** + * This is a special "command option" which is really a + * meta-option to make sure at least some specified number of a + * set of real options has been used. You may also set the + * maximum count (using the setMaxCount() method) to specify a + * maximum number of times the real options are used in total. + * The default maximum is the same as the minimum, that is, the + * default behavior is that you have to specify N exactly, no + * more, no less. + * + * As an example, if you have real options x y and z as part of + * this grouping, and N=2, the user can specify xx or yy or zz + * or xy or xz and so on. + * + * \warning There's nothing to prevent you from, say, adding + * another meta-option to the list of mutually exclusive options + * contained in a CommandOptionNOf instance (or even itself), + * but the behavior if you try this is undefined. + */ + class CommandOptionNOf : public CommandOption + { + public: + /** + * CommandOptionNOf contructor. This sets the CommandOptionType + * for this object to metaType. + */ + CommandOptionNOf(const unsigned long num) + : CommandOption(noArgument, metaType, 0, "", ""), + N(num) + { + setMaxCount(num); + } + + /// Destructor + virtual ~CommandOptionNOf() {} + + virtual std::string checkArguments(); + + /// Add an option to the list of mutually exclusive options + void addOption(CommandOption* opt) + { optionVec.push_back(opt); } + + /// @return the command options that were used (empty vector if none). + std::vector which() const; + + protected: + CommandOptionVec optionVec; + unsigned long N; + }; + /** * This is a special "command option" which is really a * meta-option to make sure at least one of a set of real diff --git a/core/lib/CommandLine/CommandOptionParser.cpp b/core/lib/CommandLine/CommandOptionParser.cpp index 732166ac8..f468ff0c9 100644 --- a/core/lib/CommandLine/CommandOptionParser.cpp +++ b/core/lib/CommandLine/CommandOptionParser.cpp @@ -200,7 +200,7 @@ namespace gpstk { pickedOption->value.push_back(string(optarg)); pickedOption->count++; - pickedOption->order = order; + pickedOption->order.push_back(order); } } @@ -217,7 +217,7 @@ namespace gpstk else if (pickedOption->optFlag == CommandOption::noArgument) { pickedOption->count++; - pickedOption->order = order; + pickedOption->order.push_back(order); } } } // itr != end() diff --git a/core/lib/FileDirProc/FileHunter.cpp b/core/lib/FileDirProc/FileHunter.cpp index de7b48398..18c3a94c4 100644 --- a/core/lib/FileDirProc/FileHunter.cpp +++ b/core/lib/FileDirProc/FileHunter.cpp @@ -52,6 +52,7 @@ using namespace gpstk::StringUtils; #ifndef _WIN32 #include #include +#include #else #include #include diff --git a/core/lib/FileHandling/Binex/BinexData.cpp b/core/lib/FileHandling/Binex/BinexData.cpp index 5e5cc8d48..78a6253c7 100644 --- a/core/lib/FileHandling/Binex/BinexData.cpp +++ b/core/lib/FileHandling/Binex/BinexData.cpp @@ -39,17 +39,17 @@ * Encapsulate BINEX file data, including I/O */ -#include - #include "BinexData.hpp" #include "BinexStream.hpp" +#include +#include using namespace std; namespace gpstk { // ========================================================================= - // BinexData::UBNXI Methods + // BinexData::UBNXI Methods // ========================================================================= // ------------------------------------------------------------------------- @@ -178,7 +178,7 @@ namespace gpstk ul1 = 0x00007f00 & (ul << 1); ul &= 0x0000007f; ul |= ul1 | ul2; - + if (littleEndian != nativeLittleEndian) { // Allow encoding to non-native byte ordering @@ -221,7 +221,7 @@ namespace gpstk ul1 = 0x007f0000 & (ul << 1); ul &= 0x00007fff; ul |= ul1 | ul2; - + if (nativeLittleEndian) { // Allow encoding to non-native byte ordering @@ -239,7 +239,7 @@ namespace gpstk FFStreamError err(errStrm.str() ); GPSTK_THROW(err); break; - } + } return size; } @@ -259,7 +259,7 @@ namespace gpstk if (reverseBytes) { - /// @TODO + /// @todo } else { @@ -267,13 +267,13 @@ namespace gpstk for (size = 0, value = 0L; (size < MAX_BYTES) && more; size++) { mask = (size < 3) ? 0x7f : 0xff; - + strm.read(&buffer[size], 1); if (!strm.good() ) { FFStreamError err("Error reading BINEX UBNXI"); GPSTK_THROW(err); - } + } if (littleEndian) { value |= ( (unsigned long)buffer[size] & mask) << (size * 7); @@ -349,7 +349,7 @@ namespace gpstk } // ========================================================================= - // BinexData::MGFZI Methods + // BinexData::MGFZI Methods // ========================================================================= // ------------------------------------------------------------------------- @@ -364,15 +364,9 @@ namespace gpstk BinexData::MGFZI::MGFZI(long long ll) throw(FFStreamError) { - value = ll; - long long absValue = value; - if (absValue < 0) - { - absValue = absValue*(-1); - } + long long absValue = llabs(ll); - if (absValue < 16LL) { size = 1; @@ -478,7 +472,7 @@ namespace gpstk { // "-0" reserved for "no data" indicator size = 0; - // TODO - throw + // todo - throw } else { @@ -554,7 +548,7 @@ namespace gpstk { reverseBuffer( (unsigned char*)&ull, 8); ull >>= 16; - } + } absValue = littleEndian ? ull >> 4 : ull & 0x00000fffffffffffULL; @@ -624,13 +618,8 @@ namespace gpstk FFStreamError err(errStrm.str() ); GPSTK_THROW(err); } - - long long absValue = value; - if (absValue < 0) - { - absValue = absValue*(-1); - } - + + long long absValue = llabs(value); unsigned char signBit = (value < 0) ? 0x01 : 0x00; size_t result = size; // Default @@ -657,51 +646,51 @@ namespace gpstk absValue -= 14LL; if (littleEndian) { - us = ( (unsigned short)signBit << 3) | (0xfff1 - & (0x0001 | (unsigned short)absValue << 4)); + us = ( (unsigned short)signBit << 3) + | (0xfff1 & (0x0001 | (unsigned short)absValue << 4) ); } else { - us = ((unsigned short)signBit << 15) | (0x1fff - & (0x1000 | (unsigned short)absValue)); + us = ((unsigned short)signBit << 15) + | (0x1fff & (0x1000 | (unsigned short)absValue) ); } if (littleEndian != nativeLittleEndian) { reverseBuffer( (unsigned char*)&us, 2); } - std::memcpy((void*)buffer, (const void*)&us, 2); + memcpy((void*)buffer, (const void*)&us, 2); break; case 3: - absValue -= 4109LL; + absValue -= 4109LL; if (littleEndian) { - ul = ((unsigned long)signBit << 3) | (0x00fffff2 - & (0x00000002 | (unsigned long)absValue << 4)); + ul = ((unsigned long)signBit << 3) + | (0x00fffff2 & (0x00000002 | (unsigned long)absValue << 4) ); } else { - ul = ((unsigned long)signBit << 31) | (0x2fffff00 - & (0x20000000 | (unsigned long)absValue << 8)); + ul = ((unsigned long)signBit << 31) + | (0x2fffff00 & (0x20000000 | (unsigned long)absValue << 8) ); } if (littleEndian != nativeLittleEndian) { reverseBuffer( (unsigned char*)&ul, 4); } - std::memcpy((void*)buffer, (const void*)&ul, 3); + memcpy((void*)buffer, (const void*)&ul, 3); break; case 4: absValue -= 1052684LL; if (littleEndian) { - ul = ((unsigned long)signBit << 3) | (0xfffffff3 - & (0x00000003 | (unsigned long)absValue << 4)); + ul = ((unsigned long)signBit << 3) + | (0xfffffff3 & (0x00000003 | (unsigned long)absValue << 4) ); } else { - ul = ((unsigned long)signBit << 31) | (0x3fffffff - & (0x30000000 | (unsigned long)absValue)); + ul = ((unsigned long)signBit << 31) + | (0x3fffffff & (0x30000000 | (unsigned long)absValue) ); } if (littleEndian != nativeLittleEndian) { @@ -714,13 +703,13 @@ namespace gpstk absValue -= 269488139LL; if (littleEndian) { - ull = ((unsigned long long)signBit << 3) | (0x000000fffffffff4ULL - & (0x0000000000000004ULL | (unsigned long long)absValue << 4)); + ull = ((unsigned long long)signBit << 3) + | (0x000000fffffffff4ULL & (0x0000000000000004ULL | (unsigned long long)absValue << 4) ); } else { - ull = ((unsigned long long)signBit << 63) | (0x4fffffffff000000ULL - & (0x4000000000000000ULL | (unsigned long long)absValue << 24)); + ull = ((unsigned long long)signBit << 63) + | (0x4fffffffff000000ULL & (0x4000000000000000ULL | (unsigned long long)absValue << 24) ); } if (littleEndian != nativeLittleEndian) { @@ -733,13 +722,13 @@ namespace gpstk absValue -= 68988964874LL; if (littleEndian) { - ull = ((unsigned long long)signBit << 3) | (0x0000fffffffffff5ULL - & (0x0000000000000005ULL| (unsigned long long)absValue << 4)); + ull = ((unsigned long long)signBit << 3) + | (0x0000fffffffffff5ULL & (0x0000000000000005ULL | (unsigned long long)absValue << 4) ); } else { - ull = ((unsigned long long)signBit << 63) | (0x5fffffffffff0000ULL - & (0x5000000000000000ULL | (unsigned long long)absValue << 16)); + ull = ((unsigned long long)signBit << 63) + | (0x5fffffffffff0000ULL & (0x5000000000000000ULL | (unsigned long long)absValue << 16) ); } if (littleEndian != nativeLittleEndian) { @@ -752,13 +741,13 @@ namespace gpstk absValue -= 17661175009289LL; if (littleEndian) { - ull = ((unsigned long long)signBit << 3) | (0x00fffffffffffff6ULL - & (0x0000000000000006ULL | (unsigned long long)absValue << 4)); + ull = ((unsigned long long)signBit << 3) + | (0x00fffffffffffff6ULL & (0x0000000000000006ULL | (unsigned long long)absValue << 4) ); } else { - ull = ((unsigned long long)signBit << 63) | (0x6fffffffffffff00ULL - & (0x6000000000000000ULL | (unsigned long long)absValue << 8)); + ull = ((unsigned long long)signBit << 63) + | (0x6fffffffffffff00ULL & (0x6000000000000000ULL | (unsigned long long)absValue << 8) ); } if (littleEndian != nativeLittleEndian) { @@ -771,13 +760,13 @@ namespace gpstk absValue -= 4521260802379784LL; if (littleEndian) { - ull = ((unsigned long long)signBit << 3) | (0xfffffffffffffff7ULL - & (0x0000000000000007ULL | (unsigned long long)absValue << 4)); + ull = ((unsigned long long)signBit << 3) + | (0xfffffffffffffff7ULL & (0x0000000000000007ULL | (unsigned long long)absValue << 4) ); } else { - ull = ((unsigned long long)signBit << 63) | (0x7fffffffffffffffULL - & (0x7000000000000000ULL | (unsigned long long)absValue)); + ull = ((unsigned long long)signBit << 63) + | (0x7fffffffffffffffULL & (0x7000000000000000ULL | (unsigned long long)absValue) ); } if (littleEndian != nativeLittleEndian) { @@ -789,9 +778,7 @@ namespace gpstk default: // If the byte count is 0, store "no value" result = 1; - unsigned char nv; - nv = 0x80; - buffer[0] = nv; + buffer[0] = 0x80; } // switch outBuffer.replace(offset, size, buffer, size); @@ -820,15 +807,13 @@ namespace gpstk ? buffer[0] & 0x0f : (buffer[0] >> 4) & 0x0f; - // Determine whether the final value is positive or negative - // and determine the number of bytes comprising the MGFZI. - //const short sign = (flags & 0x08) ? -1 : 1; + // Determine the number of bytes comprising the MGFZI. size = (flags & 0x07) + 1; if (size > 1) { strm.read((char*)&buffer[1], size - 1); - if (!strm.good() || strm.gcount() != (std::streamsize)(size - 1)) + if (!strm.good() || ((size_t)strm.gcount() + 1 != size)) { FFStreamError err("Error reading BINEX MGFZI"); GPSTK_THROW(err); @@ -898,14 +883,14 @@ namespace gpstk if (!strm.good() ) { FFStreamError err("Error writing BINEX MGFZI"); - GPSTK_THROW(err); + GPSTK_THROW(err); } return size; } // ========================================================================= - // BinexData Methods + // BinexData Methods // ========================================================================= // ------------------------------------------------------------------------- @@ -924,8 +909,8 @@ namespace gpstk // ------------------------------------------------------------------------- - BinexData::BinexData(unsigned long recordID, - unsigned char recordFlags) + BinexData::BinexData(RecordID recordID, + SyncByte recordFlags) throw() { setRecordFlags(recordFlags); @@ -954,7 +939,7 @@ namespace gpstk // ------------------------------------------------------------------------- BinexData& - BinexData::setRecordID(unsigned long id) + BinexData::setRecordID(RecordID id) throw(FFStreamError) { if (id > UBNXI::MAX_VALUE) @@ -962,50 +947,44 @@ namespace gpstk FFStreamError err("BINEX record ID overflow"); GPSTK_THROW(err); } - + recID = id; return *this; - + } // BinexData::setRecordID() // ------------------------------------------------------------------------- BinexData& - BinexData::setRecordFlags(unsigned char flags) + BinexData::setRecordFlags(SyncByte flags) { // Set all unsupported bits to 0. syncByte = flags & VALID_RECORD_FLAGS; - + // Set "regular CRC" bit (0x02) to the opposite of the enhanced CRC bit // and set the two leading always-on bits (0xC0). syncByte |= (flags & eEnhancedCRC) ? 0xC0 : 0xC2; - + return *this; } - + // ------------------------------------------------------------------------- size_t BinexData::getRecordSize() const { - size_t recSize = 1; // Start with sync byte - - UBNXI r(recID); // Add record ID - recSize += r.getSize(); - UBNXI m(msg.size() ); // Add message length - recSize += m.getSize(); - recSize += msg.size(); // Add message - - size_t crcLen = getCRCLength(recSize - 1); + size_t headLen = getHeadLength(); // Start with head length + size_t recSize = headLen + msg.size(); // Add message length + size_t crcLen = getCRCLength(recSize - 1); - recSize += crcLen; // Add CRC length + recSize += crcLen; // Add CRC length if (syncByte & eReverseReadable) { - UBNXI t(1 + r.getSize() + m.getSize() + msg.size() + crcLen); - + UBNXI t(headLen + msg.size() + crcLen); + recSize += t.getSize(); // Add total reverse length - + recSize += 1; // Add sync byte } @@ -1025,7 +1004,7 @@ namespace gpstk // ------------------------------------------------------------------------- BinexData& BinexData::ensureMessageCapacity(size_t cap) - throw(FFStreamError) + throw(InvalidParameter) { if (cap > UBNXI::MAX_VALUE) { @@ -1039,6 +1018,20 @@ namespace gpstk } // BinexData::ensureMessageCapacity() + // ------------------------------------------------------------------------- + size_t + BinexData::getHeadLength() const + { + size_t headLen = 1; // Start with sync byte + + UBNXI r(recID); // Add record ID + headLen += r.getSize(); + UBNXI m(msg.size() ); // Add message length + headLen += m.getSize(); + + return headLen; + } + // ------------------------------------------------------------------------- BinexData& BinexData::updateMessageData( @@ -1155,7 +1148,7 @@ namespace gpstk errStrm << "Message buffer offset invalid: " << offset; InvalidParameter ip(errStrm.str() ); GPSTK_THROW(ip); - } + } data.assign(msg, offset, size); offset += size; @@ -1164,22 +1157,27 @@ namespace gpstk // ------------------------------------------------------------------------- void BinexData::reallyPutRecord(FFStream& ffs) const - throw(std::exception, FFStreamError, + throw(std::exception, FFStreamError, StringUtils::StringException) { - //std::cout << "BinexData::reallyPutRecord: ENTER" << std::endl; - - BinexStream* strm = dynamic_cast(&ffs); - if (NULL == strm) + if (NULL == dynamic_cast(&ffs)) { FFStreamError e("Attempt to read a BinexData object" " from a non-BinexStream FFStream."); GPSTK_THROW(e); } + putRecord(dynamic_cast(ffs)); + } + // ------------------------------------------------------------------------- + void + BinexData::putRecord(std::ostream& strm) const + throw(std::exception, FFStreamError, + StringUtils::StringException) + { try { - unsigned char syncTail; + SyncByte syncTail; if (!isHeadSyncByteValid(syncByte, syncTail) ) { std::ostringstream errStrm; @@ -1210,8 +1208,8 @@ namespace gpstk bufLen += m.encode(headBuf, bufLen, littleEndian); // Write header buffer and message to the output stream - strm->write(headBuf.data(), headBuf.size() ); - strm->write(msg.data(), msg.size() ); + strm.write(headBuf.data(), headBuf.size() ); + strm.write(msg.data(), msg.size() ); // Calculate CRC and store it in the tail buffer std::string tailBuf; @@ -1230,7 +1228,7 @@ namespace gpstk } // Write the tail buffer to the output stream. - strm->write(tailBuf.data(), tailBuf.size() ); + strm.write(tailBuf.data(), tailBuf.size() ); } catch(std::exception& exc) { @@ -1243,47 +1241,50 @@ namespace gpstk GPSTK_THROW(err); } - if (strm->fail() || strm->bad()) + if (strm.fail() || strm.bad()) { FFStreamError err("Error writing data"); GPSTK_THROW(err); } - - //std::cout << "BinexData::reallyPutRecord: EXIT" << std::endl; } // ------------------------------------------------------------------------- - void BinexData::reallyGetRecord(FFStream& ffs) + void BinexData::reallyGetRecord(FFStream& ffs) throw(std::exception, FFStreamError, StringUtils::StringException) { - //std::cout << "BinexData::reallyGetRecord: ENTER" << std::endl; - - BinexStream* strm = dynamic_cast(&ffs); - if (NULL == strm) + if (NULL == dynamic_cast(&ffs)) { FFStreamError e("Attempt to read a BinexData object" - " from a non-BinexStream FFStream."); + " from a non-BinexStream FFStream."); GPSTK_THROW(e); } + getRecord(dynamic_cast(ffs)); + } + // ------------------------------------------------------------------------- + size_t BinexData::getRecord(std::istream& strm) + throw(std::exception, FFStreamError, StringUtils::StringException) + { size_t offset = 0; - + std::string crcBuf; size_t crcBufLen = 0; - - unsigned char expectedSyncByte; + + SyncByte expectedSyncByte; std::string expectedCrc; unsigned char crc [16]; size_t crcLen = 0; - unsigned char syncBuf; + SyncByte syncBuf; + std::istream::pos_type stpos, endpos; try { - strm->read((char*)&syncBuf, 1); // Read synchronization byte + stpos = endpos = strm.tellg(); + strm.read((char*)&syncBuf, 1); // Read synchronization byte } catch (std::exception &e) { - if ( (strm->gcount() == 0) && strm->eof() ) + if ( (strm.gcount() == 0) && strm.eof() ) { // Process as EOF EndOfFile err("EOF encountered"); @@ -1307,11 +1308,11 @@ namespace gpstk bool littleEndian = (syncByte & eBigEndian) == 0 ? true : false; UBNXI uRecID; - crcBufLen += uRecID.read(*strm, &crcBuf, crcBufLen, false, littleEndian); - setRecordID((unsigned long)uRecID); + crcBufLen += uRecID.read(strm, &crcBuf, crcBufLen, false, littleEndian); + setRecordID( (RecordID)uRecID); UBNXI uMsgLen; - crcBufLen += uMsgLen.read(*strm, &crcBuf, crcBufLen, false, littleEndian); + crcBufLen += uMsgLen.read(strm, &crcBuf, crcBufLen, false, littleEndian); unsigned long msgLen = (unsigned long)uMsgLen; @@ -1320,8 +1321,8 @@ namespace gpstk // The vector's memory will be reclaimed in all exit conditions // since the vector is allocated on the stack. std::vector msgBuf(msgLen); - strm->read((char*)&msgBuf[0], msgLen); - if (!strm->good() || (strm->gcount() != (std::streamsize)msgLen) ) + strm.read((char*)&msgBuf[0], msgLen); + if (!strm.good() || ((unsigned long)strm.gcount() != msgLen) ) { FFStreamError err("Incomplete BINEX record message"); GPSTK_THROW(err); @@ -1333,13 +1334,13 @@ namespace gpstk getCRC(crcBuf, msg, expectedCrc); crcLen = expectedCrc.size(); - strm->read( (char*)crc, crcLen); - if (!strm->good() || (strm->gcount() != (std::streamsize)crcLen) ) + strm.read( (char*)crc, crcLen); + if (!strm.good() || ((size_t)strm.gcount() != crcLen) ) { FFStreamError err("Error reading BINEX CRC"); GPSTK_THROW(err); } - if (std::memcmp(crc, expectedCrc.data(), crcLen) ) + if (memcmp(crc, expectedCrc.data(), crcLen) ) { FFStreamError err("Bad BINEX CRC"); GPSTK_THROW(err); @@ -1351,14 +1352,13 @@ namespace gpstk bool littleEndian = (expectedSyncByte & eBigEndian) == 0 ? true : false; UBNXI r, m, b; - b.read(*strm, NULL, 0, false, littleEndian); + b.read(strm, NULL, 0, false, littleEndian); unsigned long revRecSize = (unsigned long)b; // Read the entire remainder of the record into memory std::vector revRecVec(revRecSize); - strm->read( (char*)&revRecVec[0], revRecSize); - if (!strm->good() - || (strm->gcount() != (std::streamsize)revRecSize) ) + strm.read( (char*)&revRecVec[0], revRecSize); + if (!strm.good() || ((unsigned long)strm.gcount() != revRecSize) ) { FFStreamError err("Incomplete BINEX record message"); GPSTK_THROW(err); @@ -1375,10 +1375,10 @@ namespace gpstk offset += 1; offset += r.decode(revRecBuf, offset, littleEndian); - setRecordID((unsigned long)r); - // @TODO - Check against revRecSize + setRecordID( (RecordID)r); + // @todo - Check against revRecSize offset += m.decode(revRecBuf, offset, littleEndian); - // @TODO - Check against revRecSize + // @todo - Check against revRecSize msg.assign(revRecBuf, offset, (unsigned long)m); offset += msg.size(); @@ -1386,7 +1386,7 @@ namespace gpstk // Check CRC - first calculate expected, then compare to actual. getCRC(revRecBuf.substr(1, r.getSize() + m.getSize() ), msg, expectedCrc); crcLen = expectedCrc.size(); - + if ( (offset + crcLen != revRecSize) || expectedCrc.compare(revRecBuf.substr(offset, crcLen) ) ) { @@ -1403,6 +1403,7 @@ namespace gpstk GPSTK_THROW(err); } + endpos = strm.tellg(); } catch(FFStreamError& exc) { @@ -1419,7 +1420,7 @@ namespace gpstk GPSTK_THROW(err); } - //std::cout << "BinexData::reallyGetRecord: EXIT" << std::endl; + return (endpos-stpos); } void @@ -1433,7 +1434,7 @@ namespace gpstk if (crcDataLen >= 1048576) { - // @TODO - Use 16-byte CRC (128-bit MD5 checksum) + // @todo - Use 16-byte CRC (128-bit MD5 checksum) crcLen = 16; } else // (crcLen < 1048576) @@ -1513,7 +1514,7 @@ namespace gpstk crcLen = 4; } } // Regular CRC - + // Copy the CRC into the output if (!nativeLittleEndian) { @@ -1564,7 +1565,7 @@ namespace gpstk } } // Regular CRC - + } // (crcLen < 1048576) return crcLen; @@ -1572,8 +1573,8 @@ namespace gpstk // ------------------------------------------------------------------------- bool - BinexData::isHeadSyncByteValid(unsigned char headSync, - unsigned char& expectedTailSync) const + BinexData::isHeadSyncByteValid(SyncByte headSync, + SyncByte& expectedTailSync) const { switch (headSync) { @@ -1608,8 +1609,8 @@ namespace gpstk // ------------------------------------------------------------------------- bool - BinexData::isTailSyncByteValid(unsigned char tailSync, - unsigned char& expectedHeadSync) const + BinexData::isTailSyncByteValid(SyncByte tailSync, + SyncByte& expectedHeadSync) const { switch (tailSync) { @@ -1683,13 +1684,16 @@ namespace gpstk void BinexData::reverseBuffer(std::string& buffer, size_t offset, size_t n) { - if ( offset > buffer.size() ) + if (n < 2) + return; // Nothing to do + + if (offset >= buffer.size() ) { FFStreamError err("Invalid offset reversing BINEX data buffer"); GPSTK_THROW(err); } - size_t back = (n == std::string::npos) ? buffer.size() : offset + n; - if ( back > buffer.size() ) + size_t back = (n == std::string::npos) ? buffer.size() - 1: offset + n; + if (back >= buffer.size() ) { FFStreamError err("Invalid size reversing BINEX data buffer"); GPSTK_THROW(err); diff --git a/core/lib/FileHandling/Binex/BinexData.hpp b/core/lib/FileHandling/Binex/BinexData.hpp index ea5ad6a0d..ecb45a7d3 100644 --- a/core/lib/FileHandling/Binex/BinexData.hpp +++ b/core/lib/FileHandling/Binex/BinexData.hpp @@ -43,7 +43,7 @@ #define GPSTK_BINEXDATA_HPP #include "gpstkplatform.h" - + #include "BinUtils.hpp" #include "FFData.hpp" #include "FFStream.hpp" @@ -54,8 +54,8 @@ namespace gpstk //@{ - /** - * This class stores, reads, and writes BINEX records. + /** + * This class stores, reads, and writes BINEX records. * * @sa binex_read_write.cpp for an example. * @sa binex_test.cpp for an example. @@ -72,10 +72,13 @@ namespace gpstk static const bool nativeLittleEndian = false; #endif - static const unsigned long INVALID_RECORD_ID = 0xFFFFFFFF; + typedef uint32_t RecordID; ///< Record ID type + typedef uint8_t SyncByte; ///< Synchronization byte (record flags) + + static const RecordID INVALID_RECORD_ID = 0xFFFFFFFF; - static const unsigned char DEFAULT_RECORD_FLAGS = 0x20; - static const unsigned char VALID_RECORD_FLAGS = 0x38; + static const SyncByte DEFAULT_RECORD_FLAGS = 0x20; + static const SyncByte VALID_RECORD_FLAGS = 0x38; // Flags indicating whether a record is reversed, whether a record // is big endian, and whether a record contains an enhanced CRC. @@ -95,7 +98,7 @@ namespace gpstk * An unsigned integer stored using 1, 2, 3, or 4 bytes to represent * integers from 0 to 536870911; used to represent BINEX record IDs, * subrecord IDs, field IDs, and so on. - */ + */ class UBNXI { public: @@ -106,7 +109,7 @@ namespace gpstk /** * Default constructor - sets value to 0. - */ + */ UBNXI(); /** @@ -241,7 +244,7 @@ namespace gpstk * Attempts to read a valid UBNXI from the specified input stream. * The stream can be in reverse order and can be * big or little endian. If the method succeeds, the number - * of bytes used to contruct the UBNXI can be determined + * of bytes used to construct the UBNXI can be determined * by calling the getSize() method. * @param strm Stream from which to read * @param outBuffer Optional buffer to receive copy of raw input @@ -265,10 +268,10 @@ namespace gpstk * big or little endian. The method fails if the entire * UBNXI cannot be written to the stream. * @param strm Stream in which to write - * @param outBuffer Optional buffer to receive copy of raw ouput + * @param outBuffer Optional buffer to receive copy of raw output * @param offset Offset into outBuffer at which to copy output * @param reverseBytes Optional flag indicating whether - * the ouput bytes should be reversed + * the output bytes should be reversed * @param littleEndian Optional flag indicating byte order of output * @return Number of bytes added to the output stream */ @@ -292,7 +295,7 @@ namespace gpstk * modified version of a compression scheme developed by GFZ, plus * using "special" numbers to flag certain conditions, such as using * the 1-byte MFGZI to store "-0" to indicate "no value." - */ + */ class MGFZI { public: @@ -303,7 +306,7 @@ namespace gpstk /** * Default constructor - sets value to 0. - */ + */ MGFZI(); /** @@ -437,7 +440,7 @@ namespace gpstk * Attempts to read a valid MGFZI from the specified input stream. * The stream can be in reverse order and can be * big or little endian. If the method succeeds, the number - * of bytes used to contruct the MGFZI can be determined + * of bytes used to construct the MGFZI can be determined * by calling the getSize() method. * @param strm Stream from which to read * @param outBuffer Optional buffer to receive copy of raw input @@ -459,9 +462,9 @@ namespace gpstk * big or little endian. The method fails if the entire * MGFZI cannot be written to the stream. * @param strm Stream in which to write - * @param outBuffer Optional buffer to receive copy of raw ouput + * @param outBuffer Optional buffer to receive copy of raw output * @param reverseBytes Optional flag indicating whether - * the ouput bytes should be reversed + * the output bytes should be reversed * @param littleEndian Optional flag indicating byte order of output */ size_t @@ -494,8 +497,8 @@ namespace gpstk /** * Convenience constructor */ - BinexData(unsigned long recordID, - unsigned char recordFlags = DEFAULT_RECORD_FLAGS) + BinexData(RecordID recordID, + SyncByte recordFlags = DEFAULT_RECORD_FLAGS) throw(); /** @@ -524,10 +527,10 @@ namespace gpstk */ virtual void dump(std::ostream& s) const; - + /** * Compares two BinexData objects. - * + * * @param b BinexData object to compare to this object */ bool @@ -538,7 +541,7 @@ namespace gpstk * of the current record. The individual flags can be extracted from * the returned value by AND-ing with values from recordFlagsEnum. */ - inline unsigned char + inline SyncByte getRecordFlags() const { // Return only essential, valid flag bits listed in recordFlagMask @@ -558,22 +561,22 @@ namespace gpstk * Doing so is therefore highly discouraged. */ BinexData& - setRecordFlags(unsigned char flags = DEFAULT_RECORD_FLAGS); + setRecordFlags(SyncByte flags = DEFAULT_RECORD_FLAGS); /** * Returns the ID of this BINEX record. */ - inline unsigned long + inline RecordID getRecordID() const { - return recID; + return recID; }; /** * Sets the ID of this BINEX record. */ BinexData& - setRecordID(unsigned long id) + setRecordID(RecordID id) throw(FFStreamError); /** @@ -598,12 +601,23 @@ namespace gpstk */ BinexData& ensureMessageCapacity(size_t cap) - throw(FFStreamError); + throw(InvalidParameter); + + /** + * Returns the current length of the record head, i.e. the combined + * length of the synchronization byte, the record ID, and the message + * length. In other words, the returned length is the offset of the + * message data from the start of the record. + * + * @return Record head length in bytes + */ + size_t + getHeadLength() const; /** * Returns the length of the data in the record message buffer * (which is separate from the record message buffer's capacity). - * + * * @return Record message data length in bytes */ inline size_t @@ -612,9 +626,23 @@ namespace gpstk return msg.size(); }; + /** + * Returns the current length of the record tail, i.e. the combined + * length of the CRC, the optional reverse length, and the optional + * synchronization byte. In other words, the returned length is the + * number of bytes in the record following the message data. + * + * @return Record tail length in bytes + */ + inline size_t + getTailLength() const + { + return getRecordSize() - getHeadLength() - getMessageLength(); + }; + /** * Returns the capacity of the record message buffer (which is - * separate from the lenth of the data in the buffer). + * separate from the length of the data in the buffer). * * @return Record message capacity in bytes */ @@ -629,11 +657,9 @@ namespace gpstk * of the data is dependent upon the record flags at the time the * data was added to the message. */ - //inline const char* inline const std::string& getMessageData() const { - //return msg.data(); return msg; }; @@ -644,7 +670,7 @@ namespace gpstk * the message buffer. After updating the message buffer, the * value of the offset parameter is updated by size to reference * the next available byte in the message buffer. - * + * * @param offset Location within the message buffer at which to update * @param data Data with which to update the message buffer */ @@ -661,7 +687,7 @@ namespace gpstk * the message buffer. After updating the message buffer, the * value of the offset parameter is updated by size to reference * the next available byte in the message buffer. - * + * * @param offset Location within the message buffer at which to update * @param data Data with which to update the message buffer */ @@ -678,7 +704,7 @@ namespace gpstk * After updating the message buffer, the value of the offset * parameter is updated by size to reference the next available byte * in the message buffer. - * + * * @param offset Location within the message buffer at which to update * @param data Raw data with which to update the message buffer * @param size Number of bytes of data to be copied @@ -697,7 +723,7 @@ namespace gpstk * After updating the message buffer, the value of the offset * parameter is updated by size to reference the next available byte * in the message buffer. - * + * * @param offset Location within the message buffer at which to update * @param data Raw data with which to update the message buffer * @param size Number of bytes of data to be copied @@ -718,7 +744,7 @@ namespace gpstk * the message buffer. After updating the message buffer, the * value of the offset parameter is updated by size to reference * the next available byte in the message buffer. - * + * * @param offset Location within the message buffer at which to update * @param data Data with which to update the message buffer * @param size Number of bytes of data to be copied @@ -755,12 +781,12 @@ namespace gpstk } // BinexData::updateMessageData() /** - * Extacts a UBNXI from the message buffer. The location within the + * Extracts a UBNXI from the message buffer. The location within the * message buffer is set by the offset parameter. After extracting * the UBNXI from the message buffer, the value of the offset parameter * is updated by the UBNXI's size to reference the next available byte * in the message buffer. - * + * * @param offset Location within the message buffer at which to extract * @param data Location to store the extracted data */ @@ -771,12 +797,12 @@ namespace gpstk throw(FFStreamError, InvalidParameter); /** - * Extacts a MGFZI from the message buffer. The location within the + * Extracts a MGFZI from the message buffer. The location within the * message buffer is set by the offset parameter. After extracting * the MGFZI from the message buffer, the value of the offset parameter * is updated by the MGFZI's size to reference the next available byte * in the message buffer. - * + * * @param offset Location within the message buffer at which to extract * @param data Location to store the extracted data */ @@ -787,14 +813,14 @@ namespace gpstk throw(FFStreamError, InvalidParameter); /** - * Extacts raw data from the message buffer. The location within the + * Extracts raw data from the message buffer. The location within the * message buffer is set by the offset parameter, and the size of the * data to extract is set by the size parameter. This method checks * to ensure that all data is extracted from within the message * buffer. After extracting data from the message buffer, * the value of the offset parameter is updated by size to reference * the next available byte in the message buffer. - * + * * @param offset Location within the message buffer at which to extract * @param data Location to store the extracted data * @param size Number of bytes of data to be extracted @@ -807,7 +833,7 @@ namespace gpstk throw(InvalidParameter); /** - * Extacts data from the message buffer. The location within the + * Extracts data from the message buffer. The location within the * message buffer is set by the offset parameter, and the size of the * data to extract is set by the size parameter. This method checks * to ensure that the value of the size parameter does not exceed @@ -815,7 +841,7 @@ namespace gpstk * message buffer. After extracting data from the message buffer, * the value of the offset parameter is updated by size to reference * the next available byte in the message buffer. - * + * * @param offset Location within the message buffer at which to extract * @param data Location to store the extracted data * @param size Number of bytes of data to be extracted @@ -834,14 +860,14 @@ namespace gpstk errStrm << "Data size invalid: " << size; InvalidParameter ip(errStrm.str() ); GPSTK_THROW(ip); - } + } if (offset + size > msg.size() ) { std::ostringstream errStrm; errStrm << "Message buffer offset invalid: " << offset; InvalidParameter ip(errStrm.str() ); GPSTK_THROW(ip); - } + } bool littleEndian = ( (syncByte & eBigEndian) == 0) ? true : false; msg.copy(reinterpret_cast(&data), size, offset); if (littleEndian != nativeLittleEndian) @@ -853,6 +879,23 @@ namespace gpstk } // BinexData::extractMessageData() + /** + * Writes the BINEX data to the specified generic output stream. + */ + virtual void + putRecord(std::ostream& s) const + throw(std::exception, FFStreamError, + StringUtils::StringException); + + /** + * Retrieves a BINEX record from the specified generic input stream. + * @return the number of bytes parsed in the stream. + */ + virtual size_t + getRecord(std::istream& s) + throw(std::exception, FFStreamError, + StringUtils::StringException); + protected: /** @@ -860,10 +903,10 @@ namespace gpstk */ virtual void reallyPutRecord(FFStream& s) const - throw(std::exception, FFStreamError, - StringUtils::StringException); + throw(std::exception, FFStreamError, + StringUtils::StringException); - /** + /** * This function retrieves a BINEX record from the given FFStream. * If an error is encountered in reading from the stream, the stream * is returned to its original position and its fail-bit is set. @@ -873,7 +916,7 @@ namespace gpstk * stream to its pre-read position. */ virtual void - reallyGetRecord(FFStream& s) + reallyGetRecord(FFStream& s) throw(std::exception, FFStreamError, StringUtils::StringException); @@ -889,7 +932,7 @@ namespace gpstk /** * Returns the number of bytes required to store the record's CRC - * based on the record's current contents. + * based on the record's current contents. */ size_t getCRCLength(size_t crcDataLen) const; @@ -899,16 +942,16 @@ namespace gpstk * an expected correosponding tail sync byte if appropriate. */ bool - isHeadSyncByteValid(unsigned char headSync, - unsigned char& expectedTailSync) const; + isHeadSyncByteValid(SyncByte headSync, + SyncByte& expectedTailSync) const; /** * Determines whether the supplied tail sync byte is valid an returns * an expected correosponding head sync byte. */ bool - isTailSyncByteValid(unsigned char tailSync, - unsigned char& expectedHeadSync) const; + isTailSyncByteValid(SyncByte tailSync, + SyncByte& expectedHeadSync) const; /** * Converts a raw sequence of bytes into an unsigned long long integer. * @@ -926,7 +969,7 @@ namespace gpstk /** * Reverses the order of the first bufferLength bytes in the * specified buffer. - * + * * @param buffer Pointer to the bytes * @param bufferLength Number of bytes to reverse */ @@ -937,7 +980,7 @@ namespace gpstk /** * Reverses the order of the first bufferLength bytes in the * specified buffer. - * + * * @param buffer String containing bytes to reverse * @param offset Starting position of bytes to reverse * @param n Number of bytes to reverse @@ -950,9 +993,9 @@ namespace gpstk /** @name Attributes */ //@{ - unsigned char syncByte; ///< Flags for endianness, CRC, etc. - unsigned long recID; ///< Record ID - std::string msg; ///< Record message (opaque) + SyncByte syncByte; ///< Flags for endianness, CRC, etc. + RecordID recID; ///< Record ID + std::string msg; ///< Record message (opaque) //@} private: diff --git a/core/lib/FileHandling/RINEX/RinexNavData.cpp b/core/lib/FileHandling/RINEX/RinexNavData.cpp index df50cb7c1..6dc6a8390 100644 --- a/core/lib/FileHandling/RINEX/RinexNavData.cpp +++ b/core/lib/FileHandling/RINEX/RinexNavData.cpp @@ -94,7 +94,7 @@ namespace gpstk } void RinexNavData::reallyPutRecord(FFStream& ffs) const - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { RinexNavStream& strm = dynamic_cast(ffs); @@ -117,7 +117,7 @@ namespace gpstk } void RinexNavData::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { RinexNavStream& strm = dynamic_cast(ffs); diff --git a/core/lib/FileHandling/RINEX/RinexObsData.cpp b/core/lib/FileHandling/RINEX/RinexObsData.cpp index c21e6306e..3b252a1d5 100644 --- a/core/lib/FileHandling/RINEX/RinexObsData.cpp +++ b/core/lib/FileHandling/RINEX/RinexObsData.cpp @@ -179,7 +179,7 @@ namespace gpstk void RinexObsData::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, gpstk::StringUtils::StringException) + throw(std::exception, FFStreamError, gpstk::StringUtils::StringException) { RinexObsStream& strm = dynamic_cast(ffs); diff --git a/core/lib/FileHandling/RINEX/RinexUtilities.cpp b/core/lib/FileHandling/RINEX/RinexUtilities.cpp index a3eba2cb0..994c175f7 100644 --- a/core/lib/FileHandling/RINEX/RinexUtilities.cpp +++ b/core/lib/FileHandling/RINEX/RinexUtilities.cpp @@ -155,7 +155,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -182,7 +182,7 @@ bool isSP3File(const string& file) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); @@ -208,18 +208,18 @@ bool isRinexNavFile(const string& file) rnstream.exceptions(fstream::failbit); } catch(Exception& e) { return false; } - catch(exception& e) { return false;} + catch(std::exception& e) { return false;} try { rnstream >> header; } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } rnstream.close(); return true; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } @@ -243,12 +243,12 @@ bool isRinex3NavFile(const string& file) rnstream.exceptions(fstream::failbit); } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } try { rnstream >> header; } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } rnstream.close(); return true; @@ -257,7 +257,7 @@ bool isRinex3NavFile(const string& file) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); @@ -283,19 +283,19 @@ bool isRinexObsFile(const string& file) rostream.exceptions(fstream::failbit); } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } try { rostream >> header; } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } rostream.close(); return true; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } @@ -319,19 +319,19 @@ bool isRinex3ObsFile(const string& file) rostream.exceptions(fstream::failbit); } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } try { rostream >> header; } catch(Exception& e) { return false; } - catch(exception& e) { return false; } + catch(std::exception& e) { return false; } rostream.close(); return true; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } @@ -389,7 +389,7 @@ try { return msg; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -439,7 +439,7 @@ string sortRinex3ObsFiles(vector& files) } } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } @@ -500,7 +500,7 @@ int FillEphemerisStore(const vector& files, SP3EphemerisStore& PE, return nread; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } diff --git a/core/lib/FileHandling/RINEX3/Rinex3ObsData.cpp b/core/lib/FileHandling/RINEX3/Rinex3ObsData.cpp index 9b7f32337..136da06f3 100644 --- a/core/lib/FileHandling/RINEX3/Rinex3ObsData.cpp +++ b/core/lib/FileHandling/RINEX3/Rinex3ObsData.cpp @@ -408,7 +408,7 @@ namespace gpstk } } // string exceptions for substr are caught here - catch(exception &e) + catch(std::exception &e) { FFStreamError err("std::exception: " + string(e.what())); GPSTK_THROW(err); @@ -469,7 +469,7 @@ namespace gpstk } // end loop over numSVs // loop over all sats, reading obs data - int numObs(strm.header.R2ObsTypes.size());// number of R2 OTs in header + unsigned numObs(strm.header.R2ObsTypes.size());// number of R2 OTs in header rod.obs.clear(); for(isv=0; isv < rod.numSVs; isv++) { //strm.formattedGetLine(line); // get a line @@ -530,7 +530,7 @@ namespace gpstk void Rinex3ObsData::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, gpstk::StringUtils::StringException) + throw(std::exception, FFStreamError, gpstk::StringUtils::StringException) { Rinex3ObsStream& strm = dynamic_cast(ffs); diff --git a/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp b/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp index 0694afdb4..49e92f7cc 100644 --- a/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp +++ b/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp @@ -90,7 +90,7 @@ namespace gpstk const string Rinex3ObsHeader::stringEoH = "END OF HEADER"; void Rinex3ObsHeader::reallyPutRecord(FFStream& ffs) const - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { Rinex3ObsStream& strm = dynamic_cast(ffs); @@ -186,13 +186,13 @@ namespace gpstk if(version >= 3 && (valid & validAntennaZeroDirAzi)) n++; if(version >= 3 && (valid & validAntennaZeroDirXYZ)) n++; if(version >= 3 && (valid & validCenterOfMass)) n++; - if(version < 3 && (valid & validNumObs)) - n += 1 + (obsTypeList.size()-1)/9; - if(version >= 3 && (valid & validSystemObsType)) - n += 1 + (obsTypeList.size()-1)/9; + if(version < 3 && (valid & validNumObs) && R2ObsTypes.size() != 0) + n += 1 + (R2ObsTypes.size()-1)/9; + if(version >= 3 && (valid & validSystemObsType) && numObs != 0) + n += 1 + (numObs-1)/9; if(version < 3 && (valid & validWaveFact)) { n++; - if(extraWaveFactList.size()) n += (extraWaveFactList.size()-1)/7; + if(extraWaveFactList.size() != 0) n += extraWaveFactList.size(); } if(version >= 3 && (valid & validSigStrengthUnit)) n++; if(valid & validInterval ) n++; @@ -769,7 +769,7 @@ namespace gpstk if(version >= 3.01 && (valid & validGlonassFreqNo)) { //map GlonassFreqNo; - int n(0),nsat(GlonassFreqNo.size()); + size_t n(0),nsat(GlonassFreqNo.size()); line = rightJustify(asString(nsat),3) + string(" "); map::const_iterator it,kt; for(it = GlonassFreqNo.begin(); it != GlonassFreqNo.end(); ++it) { @@ -1429,7 +1429,7 @@ namespace gpstk // This function parses the entire header from the given stream void Rinex3ObsHeader::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, + throw(std::exception, FFStreamError, gpstk::StringUtils::StringException) { Rinex3ObsStream& strm = dynamic_cast(ffs); @@ -1463,7 +1463,7 @@ namespace gpstk try { -// std::cout << "Parse header record >" << line << "<" << std::endl; + //std::cout << "Parse header record >" << line << "<" << std::endl; ParseHeaderRecord(line); } catch(FFStreamError& e) @@ -1504,125 +1504,73 @@ namespace gpstk syss.push_back("S"); // ?? syss.push_back("E"); } - // are there any sats with non-1 wavelength factors? if so must add "N" types - //bool haveL1WaveFact(false), haveL2WaveFact(false); - //bool haveMultipleL1WaveFact(false), haveMultipleL2WaveFact(false); - //if(find(syss.begin(),syss.end(),"G") != syss.end()) { // has GPS - // if(wavelengthFactor[0] != 1) haveL1WaveFact = true; - // if(wavelengthFactor[1] != 1) haveL2WaveFact = true; - // for(int i=0; i < extraWaveFactList.size(); i++) { - // if(extraWaveFactList[i].wavelengthFactor[0] != 1) - // haveMultipleL1WaveFact = true; - // if(extraWaveFactList[i].wavelengthFactor[1] != 1) - // haveMultipleL2WaveFact = true; - // } - //} // given systems and list of R2ObsTypes, compute mapObsTypes and mapSysR2toR3ObsID mapSysR2toR3ObsID.clear(); for(size_t i=0; i obsids; - //bool isPrecise( - // find(R2ObsTypes.begin(),R2ObsTypes.end(),"P1") != R2ObsTypes.end() || - // find(R2ObsTypes.begin(),R2ObsTypes.end(),"P2") != R2ObsTypes.end() - //); //Unused, commenting out for now - // loop over R2 obs types - for(size_t j=0; j C2X L2X S2X D2X (C2 not P2) - // P2 L2 S2 D2 => C2W L2W S2W D2W (P2 not C2) - // C2 P2 L2 S2 D2 => C2X C2W L2W S2W D2W (C2 and P2) - if(s=="G" && ot[1]=='2') { - if(ot[0] == 'C') { type = "C"; tc = "X"; } // C2 - else if(ot[0] == 'P') { type = "C"; tc = "W"; } // P2 - else { type = ot[0]; tc = (isPrecise ? "W":"X"); } // L2 S2 D2 - obsid = string(s+type+string(1,ot[1])+tc); - } - - // GPS+GLO 1+2 - // GPS and GLO (but GPS w/ wavelengthFactor -> tracking code N) - // C1 L1 S1 D1 => C1C L1C S1C D1C (C1 not P1) - // P1 L1 S1 D1 => C1P L1P S1P D1P (P1 not C1) - // C1 P1 L1 S1 D1 => C1C C1P L1P S1P D1P - // C2 L2 S2 D2 => C2C L2C S2C D2C (C2 not P2) - // P2 L2 S2 D2 => C2P L2P S2P D2P (P2 not C2) - // C2 P2 L2 S2 D2 => C2C C2P L2P S2P D2P - else if((s=="G" || s=="R") && (ot[1]=='1' || ot[1]=='2')) { - if(ot[0] == 'C') { type = tc = "C"; } // C1 - else if(ot[0] == 'P') { type = "C"; tc = "P"; } // P12 - else { type = ot[0]; tc = (isPrecise ? "P":"C"); } // L12 S12 D12 - - // wavelengthFactor: all sats -> N replaces C/P, some -> N & C/P - // TD but this screws up the ordering of obs for Data::really*() - //if(ot[1]=='1' && haveMultipleL1WaveFact) { - // OT = RinexObsID(s+type+string(1,ot[1])+tc); - // obsids.push_back(OT); // have both - // tc = "N"; // TD there is no C1N or C2N - //} - //if(ot[1]=='1' && haveL1WaveFact) tc = "N"; - //if(ot[1]=='2' && haveMultipleL2WaveFact) { - // OT = RinexObsID(s+type+string(1,ot[1])+tc); - // obsids.push_back(OT); - // tc = "N"; - //} - //if(ot[1]=='2' && haveL2WaveFact) tc = "N"; - - obsid = string(s+type+string(1,ot[1])+tc); - } - - // GPS 5 - // C5 L5 S5 D5 => C5X L5X S5X D5X - else if(s == "G" && ot[1] == '5') { - if(ot == "C5") obsid = string("GC5X"); // C5 - else obsid = string(s+ot+"X"); // L5 S5 D5 - } - - // GAL - // C1 L1 S1 D1 => C1C L1C S1C D1C (E2-L1-E1) - // C5 L5 S5 D5 => C5X L5X S5X D5X (E5a) - // C6 L6 S6 D6 => C6X L6X S6X D6X (E6) - // C7 L7 S7 D7 => C7X L7X S7X D7X (E5b) - // C8 L8 S8 D8 => C8X L8X S8X D8X (E5a+b) - else if(s == "E") { - if(ot[0] != 'P' && ot[1] != '2') // CLDS x 15678 - obsid = string(s+ot+(ot[1]=='1' ? "C" : "X")); - //else obsid = string("EC1*"); // (P*,*2) not allowed - } - - // SBAS / GEO - // C1 L1 D1 => C1C L1C D1C S1C - // C5 L5 D5 => C5X L5X D5X S5X - else if(s == "S") { - if(ot == "C1") obsid = string("SC1C"); - else if(ot == "L1") obsid = string("SL1C"); - else if(ot == "D1") obsid = string("SD1C"); - else if(ot == "S1") obsid = string("SS1C"); - else if(ot == "C5") obsid = string("SC5X"); - else if(ot == "L5") obsid = string("SL5X"); - else if(ot == "D5") obsid = string("SD5X"); - else if(ot == "S5") obsid = string("SS5X"); - } - - // create the obs id and save it - if(!obsid.empty()) { - RinexObsID OT; - try { - OT = RinexObsID(obsid); - } - catch(InvalidParameter& ip) { - FFStreamError fse("InvalidParameter: "+ip.what()); - GPSTK_THROW(fse); - } + + // Assume D1, S1, and L1 come from C/A unless P is being treated as Y and P1 is present + bool hasL1P = find(R2ObsTypes.begin(),R2ObsTypes.end(), string("P2")) != R2ObsTypes.end(); + string code1 = "C"; + if (PisY && hasL1P) code1 = "Y"; + + // Assume D2, S2, and L2 come from Y if P is being treated as Y and P2 is present + // codeless unless L2C is tracked + bool hasL2P = find(R2ObsTypes.begin(),R2ObsTypes.end(), string("P2")) != R2ObsTypes.end(); + bool hasL2C = find(R2ObsTypes.begin(),R2ObsTypes.end(), string("C2")) != R2ObsTypes.end(); + string code2 = "W"; + if (PisY && hasL2P) code2 = "Y"; + else if (hasL2C) code2 = "X"; + + for(size_t j=0; j > } - + catch(InvalidParameter& ip) + { + FFStreamError fse("InvalidParameter: "+ip.what()); + GPSTK_THROW(fse); + } } // end for // TD if GPS and have wavelengthFactors, add more ObsIDs with tc=N @@ -1713,15 +1661,30 @@ namespace gpstk strm.timesystem == TimeSystem::Unknown) { if(fileSysSat.system == SatID::systemGPS) + { strm.timesystem = TimeSystem::GPS; + firstObs.setTimeSystem(TimeSystem::GPS); + } else if(fileSysSat.system == SatID::systemGlonass) + { strm.timesystem = TimeSystem::UTC; + firstObs.setTimeSystem(TimeSystem::UTC); + } else if(fileSysSat.system == SatID::systemGalileo) + { strm.timesystem = TimeSystem::GAL; + firstObs.setTimeSystem(TimeSystem::GAL); + } else if(fileSysSat.system == SatID::systemQZSS) + { strm.timesystem = TimeSystem::QZS; + firstObs.setTimeSystem(TimeSystem::QZS); + } else if(fileSysSat.system == SatID::systemBeiDou) + { strm.timesystem = TimeSystem::BDT; + firstObs.setTimeSystem(TimeSystem::BDT); + } else if(fileSysSat.system == SatID::systemMixed) { FFStreamError e("TimeSystem in MIXED files must be given by first obs"); GPSTK_THROW(e); @@ -2096,7 +2059,6 @@ namespace gpstk // 'old-style' type: Let's change it to 'new style'. if( type.size() == 2 ) { - if( type == "C1" ) type = "C1C"; else if( type == "P1" ) type = "C1P"; else if( type == "L1" ) type = "L1P"; diff --git a/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.hpp b/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.hpp index e3445a966..092254217 100644 --- a/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.hpp +++ b/core/lib/FileHandling/RINEX3/Rinex3ObsHeader.hpp @@ -71,7 +71,7 @@ namespace gpstk public: /// A Simple Constructor. - Rinex3ObsHeader() : valid(0), validEoH(false) + Rinex3ObsHeader() : valid(0), validEoH(false), PisY(false) {} /// Clear (empty out) header @@ -280,6 +280,7 @@ namespace gpstk ///< for cont. lines numObsPrev; ///< recall the prev # obs for cont. lines RinexSatID lastPRN; ///< save PRN while reading PRN/OBS cont. lines + bool PisY; ///< Map P to Y code observations in RINEX 2 files //@} /// Destructor diff --git a/core/lib/FileHandling/SINEX/SinexBlock.hpp b/core/lib/FileHandling/SINEX/SinexBlock.hpp index c6e208d1e..ebfd6e355 100644 --- a/core/lib/FileHandling/SINEX/SinexBlock.hpp +++ b/core/lib/FileHandling/SINEX/SinexBlock.hpp @@ -17,6 +17,7 @@ #include #include #include "SinexBase.hpp" +#include "SinexTypes.hpp" namespace gpstk { @@ -112,7 +113,8 @@ namespace Sinex { try { - s << (std::string)(*i) << std::endl; + const Sinex::DataType& d = *i; + s << (std::string)d << std::endl; } catch (Exception& exc) { diff --git a/core/lib/GNSSCore/IonoModelStore.cpp b/core/lib/GNSSCore/IonoModelStore.cpp index 01bc8b97c..9d7731a83 100644 --- a/core/lib/GNSSCore/IonoModelStore.cpp +++ b/core/lib/GNSSCore/IonoModelStore.cpp @@ -108,4 +108,25 @@ namespace gpstk } // End of method 'IonoModelStore::addIonoModel()' + /** Edit the dataset, removing data outside the indicated time interval + * + * \param tmin defines the beginning of the time interval + * \param tmax defines the end of the time interval + */ + void IonoModelStore::edit(const CommonTime& tmin, + const CommonTime& tmax) + { + IonoModelMap::iterator lower = ims.lower_bound(tmin); + if (lower != ims.begin()) + { + ims.erase(ims.begin(), lower); + } + IonoModelMap::iterator upper = ims.upper_bound(tmax); + if (upper != ims.end()) + { + ims.erase(upper, ims.end()); + } + } + + } // End of namespace gpstk diff --git a/core/lib/GNSSCore/IonoModelStore.hpp b/core/lib/GNSSCore/IonoModelStore.hpp index a520dd9d5..4c2c7020f 100644 --- a/core/lib/GNSSCore/IonoModelStore.hpp +++ b/core/lib/GNSSCore/IonoModelStore.hpp @@ -104,6 +104,13 @@ namespace gpstk const IonoModel& im ) throw(); + /** Edit the dataset, removing data outside the indicated time interval + * + * \param tmin defines the beginning of the time interval + * \param tmax defines the end of the time interval + */ + void edit(const CommonTime& tmin, + const CommonTime& tmax = CommonTime::END_OF_TIME); private: diff --git a/ext/lib/Misc/SVNumXRef.cpp b/core/lib/GNSSCore/SVNumXRef.cpp similarity index 86% rename from ext/lib/Misc/SVNumXRef.cpp rename to core/lib/GNSSCore/SVNumXRef.cpp index 11c9e0a06..a7103c046 100755 --- a/ext/lib/Misc/SVNumXRef.cpp +++ b/core/lib/GNSSCore/SVNumXRef.cpp @@ -109,6 +109,8 @@ SVNumXRef::SVNumXRef( ) NtoBMap.insert( make_pair( 67,IIF )); NtoBMap.insert( make_pair( 68,IIF )); NtoBMap.insert( make_pair( 69,IIF )); + NtoBMap.insert( make_pair( 71,IIF )); + NtoBMap.insert( make_pair( 72,IIF )); // Note: This table start with Block I values @@ -188,9 +190,10 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 25, XRefNode( 25, CivilTime( 1992, 2, 23, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2009, 12, 18, 22, 28, 0.0, TimeSystem::GPS)))); + // NANU 2015005 (end) - extended due to additional data. NtoPMap.insert( std::pair( 26, XRefNode( 26, CivilTime( 1992, 7, 7, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); + CivilTime( 2015, 1, 20, 23, 59, 59.9, TimeSystem::GPS)))); // NANU # (start). NANU 2012061 (end) // NANU #(start). NANU 2011059 (end). NtoPMap.insert( std::pair( 27, XRefNode( 27, @@ -204,6 +207,10 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 27, XRefNode( 30, CivilTime( 2013, 12, 3, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2013, 12, 17, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015010 (start). NANU 2013019 (end) plus actual received data. + NtoPMap.insert( std::pair( 27, XRefNode( 26, + CivilTime( 2015, 2, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 3, 16, 23, 59, 59.9, TimeSystem::GPS)))); NtoPMap.insert( std::pair( 28, XRefNode( 28, CivilTime( 1992, 4, 10, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 1997, 8, 15, 23, 59, 59.9, TimeSystem::GPS)))); @@ -227,9 +234,15 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 32, XRefNode( 30, CivilTime( 2013, 8, 22, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2013, 9, 18, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015007 (start). NANU 2015101 (end) plus actual received data + NtoPMap.insert( std::pair( 32, XRefNode( 26, + CivilTime( 2015, 2, 5, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 2, 24, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2014063 (end). + // NANU claimed 8/2 end date. SV continued to broadcast until 8/18/2014. NtoPMap.insert( std::pair( 33, XRefNode( 3, CivilTime( 1996, 3, 28, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 8, 2, 0, 0, 0.0, TimeSystem::GPS)))); + CivilTime( 2014, 8, 18 , 23, 59, 59.9, TimeSystem::GPS)))); NtoPMap.insert( std::pair( 34, XRefNode( 4, CivilTime( 1993, 10, 26, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); @@ -260,9 +273,14 @@ SVNumXRef::SVNumXRef( ) CivilTime( 2014, 10, 22, 0, 00, 0.0, TimeSystem::GPS)))); // NANU 2014015/2014019 (end) + // NANU claimed 2/21 end date. SV continued to broadcast until 3/3/2014. NtoPMap.insert( std::pair( 36, XRefNode( 6, CivilTime( 1995, 3, 10, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 2, 21, 14, 30, 0.0, TimeSystem::GPS)))); + CivilTime( 2014, 3, 3, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015080 (start) + NtoPMap.insert( std::pair( 36, XRefNode( 10, + CivilTime( 2015, 9, 16, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); NtoPMap.insert( std::pair( 37, XRefNode( 7, CivilTime( 1993, 5, 13, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2007, 7, 20, 23, 59, 59.9, TimeSystem::GPS)))); @@ -277,20 +295,22 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 37, XRefNode( 30, CivilTime( 2013, 9, 19, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2013, 12, 2, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015021 (end) NtoPMap.insert( std::pair( 38, XRefNode( 8, CivilTime( 1997, 11, 6, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); + CivilTime( 2015, 4, 13, 23, 59, 59.9, TimeSystem::GPS)))); // NANU 2014046 (end) + // NANU claimed 5/19 end date. SV continued tp broadcast until 5/27/2014. NtoPMap.insert( std::pair( 39, XRefNode( 9, CivilTime( 1993, 6, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 5, 19, 22, 0, 0.0, TimeSystem::GPS)))); + CivilTime( 2014, 5, 27, 23, 59, 59.9, TimeSystem::GPS)))); // NANU 2014050 (start) NtoPMap.insert( std::pair( 39, XRefNode( 9, CivilTime( 2014, 6, 13, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 8, 2, 0, 0, 0.0, TimeSystem::GPS)))); + CivilTime( 2014, 8, 1, 23, 59, 59.9, TimeSystem::GPS)))); NtoPMap.insert( std::pair( 40, XRefNode( 10, CivilTime( 1996, 7, 16, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); + CivilTime( 2015, 7, 16, 0, 0, 0.0, TimeSystem::GPS)))); NtoPMap.insert( std::pair( 41, XRefNode( 14, CivilTime( 2000, 11, 10, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); @@ -343,10 +363,15 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 49, XRefNode( 30, CivilTime( 2013, 12, 18, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2014, 2, 20, 23, 59, 0.0, TimeSystem::GPS)))); - // NANU 2014032 (start), , 2014045 (end-IMPLIED) + // NANU 2014032 (start), 2014045 (end-IMPLIED) NtoPMap.insert( std::pair( 49, XRefNode( 6, CivilTime( 2014, 4, 3, 0, 0, 0.0, TimeSystem::GPS), CivilTime( 2014, 5, 15, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015032 (start) + NtoPMap.insert( std::pair( 49, XRefNode( 8, + CivilTime( 2015, 4, 30, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 7, 1, 16, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 50, XRefNode( 5, CivilTime( 2009, 8, 27, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); @@ -393,9 +418,11 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 64, XRefNode( 30, CivilTime( 2014, 2, 21, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 65, XRefNode( 24, CivilTime( 2012, 10, 4, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 66, XRefNode( 27, CivilTime( 2013, 5, 15, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); @@ -411,6 +438,14 @@ SVNumXRef::SVNumXRef( ) NtoPMap.insert( std::pair( 69, XRefNode( 3, CivilTime( 2014, 10, 29, 0, 0, 0.0, TimeSystem::GPS), CommonTime::END_OF_TIME ))); + //NANU 2015019 LAUNCH + NtoPMap.insert( std::pair( 71, XRefNode( 26, + CivilTime( 2015, 3, 25, 18, 36, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + //NANU 2015068 LAUNCH + NtoPMap.insert( std::pair( 72, XRefNode( 8, + CivilTime( 2015, 7, 15, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); //Iterate through the data to produce the PtoNMap multimap::const_iterator itate; @@ -678,6 +713,7 @@ bool XRefNode::isApplicable( gpstk::CommonTime dt ) const std::string XRefNode::toString() const { std::string sout; + std::string tform = "%02m/%02d/9.4Y %03j %02H:%02M:%05.2f"; //create stringstream to convert Num to a string to concatinate to sout std::stringstream ss; ss << Num; @@ -686,16 +722,63 @@ std::string XRefNode::toString() const sout += " "+numOut; //sout += " "+string(begValid begDt); if( Num < 10 ){//used to create correct spacing - sout += " "+printTime(begValid,"%02m/%02d/%04Y"); + sout += " "+printTime(begValid, tform/*"%02m/%02d/%04Y"*/); }else{ - sout += " "+printTime(begValid,"%02m/%02d/%04Y"); + sout += " "+printTime(begValid, tform/*"%02m/%02d/%04Y"*/); } - std::string endTime = printTime(endValid, "%02m/%02d/%04Y"); + std::string endTime = printTime(endValid, tform/*"%02m/%02d/%04Y"*/); if(endTime == "01/01/4713"){//used to detect end of time sout += " End Of Time"; }else{ - sout += " "+printTime(endValid,"%02m/%02d/%04Y"); + sout += " "+printTime(endValid, tform/*"%02m/%02d/%04Y"*/); } return sout; } +// Returns true if there are no overlaps, and false otherwise +bool SVNumXRef::isConsistent() const +{ + // Defining iterators + multimap::const_iterator cit1; + multimap::const_iterator cit2; + // loops through the multimap + for (cit1 = NtoPMap.begin(); cit1 != NtoPMap.end(); cit1++) + { + cit2 = cit1; + cit2++; // cit2 always starts the nested loop one higher than cit1 + for (; cit2 != NtoPMap.end(); cit2++) + { + int key1 = cit1->first; // keys represent the SVN numbers + int key2 = cit2->first; + const XRefNode xr1 = cit1->second; // these const xr variables represent the XRefNode so we can access the begin and end times + const XRefNode xr2 = cit2->second; // of each SVN/PRN pair + int val1 = xr1.getPRNNum(); // vals represent the PRN numbers + int val2 = xr2.getPRNNum(); + if ((key1 == key2) || (val1 == val2)) // checks initial condition for an overlap; if neither are true, there is no overlap + { + cout << "key 1 & 2: " << key1 << ", " << key2 << endl + << "val 1 & 2: " << val1 << ", " << val2 << endl + << "xr1:" << xr1.toString() << endl + << "xr2:" << xr2.toString() << endl; + + if (overlap(xr1, xr2)) // if overlap() returns true, return false and exit + return false; + } + } + } + return true; // if we reach this point, we know there are no overlaps +} + +// Returns true if there is an overlap, returns false otherwise +bool SVNumXRef::overlap (const XRefNode& xr1, const XRefNode& xr2) const +{ + //if ((xr1.getBeginTime() > xr2.getEndTime()) || (xr1.getEndTime() < xr2.getBeginTime())) + if ((xr1.getBeginTime() < xr2.getEndTime()) && (xr1.getEndTime() > xr2.getBeginTime())) + { + cout << xr1.getBeginTime() << xr1.getEndTime() << endl + << xr2.getBeginTime() << xr2.getEndTime() << endl; + return true; + } + return false; +} + diff --git a/ext/lib/Misc/SVNumXRef.hpp b/core/lib/GNSSCore/SVNumXRef.hpp similarity index 97% rename from ext/lib/Misc/SVNumXRef.hpp rename to core/lib/GNSSCore/SVNumXRef.hpp index ba2441bd9..9ce80ed85 100644 --- a/ext/lib/Misc/SVNumXRef.hpp +++ b/core/lib/GNSSCore/SVNumXRef.hpp @@ -15,9 +15,10 @@ // You should have received a copy of the GNU Lesser General Public // License along with GPSTk; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// // Copyright 2004, The University of Texas at Austin +// Copyright 2004, The University of Texas at Austin // //============================================================================ + /* SVNumXRef.hpp * * Applied Research Laboratories, The University of Texas at Austin @@ -144,6 +145,8 @@ class SVNumXRef bool BlockTypeAvailable( const int NAVSTARID ) const; bool NAVSTARIDActive( const int NAVSTARID, const gpstk::CommonTime dt = SystemTime() ) const; int dump(std::ostream& out=std::cout, bool checkOverlap=false) const; + bool isConsistent() const; + bool overlap( const XRefNode& xr1, const XRefNode& xr2) const; protected: std::multimap NtoPMap; diff --git a/core/lib/GNSSEph/BrcClockCorrection.cpp b/core/lib/GNSSEph/BrcClockCorrection.cpp index 281637914..6e3a22197 100644 --- a/core/lib/GNSSEph/BrcClockCorrection.cpp +++ b/core/lib/GNSSEph/BrcClockCorrection.cpp @@ -210,6 +210,17 @@ namespace gpstk return PRNID; } + ObsID BrcClockCorrection::getObsID() const + throw(InvalidRequest) + { + if(!dataLoaded) + { + InvalidRequest exc("Required data not stored."); + GPSTK_THROW(exc); + } + return obsID; + } + short BrcClockCorrection::getFullWeek() const throw(InvalidRequest) { diff --git a/core/lib/GNSSEph/BrcClockCorrection.hpp b/core/lib/GNSSEph/BrcClockCorrection.hpp index 45c7fcd3f..5ede9e839 100644 --- a/core/lib/GNSSEph/BrcClockCorrection.hpp +++ b/core/lib/GNSSEph/BrcClockCorrection.hpp @@ -106,6 +106,9 @@ namespace gpstk /** This function returns the PRN ID of the SV. */ short getPRNID() const throw(gpstk::InvalidRequest); + /** This function returns the OBS ID of the clock correction. */ + ObsID getObsID() const throw(gpstk::InvalidRequest); + /** * This function returns the value of the SV accuracy (m) * computed from the accuracy flag in the nav message. */ diff --git a/core/lib/GNSSEph/BrcKeplerOrbit.cpp b/core/lib/GNSSEph/BrcKeplerOrbit.cpp index d3e495e7b..986c6fc1f 100644 --- a/core/lib/GNSSEph/BrcKeplerOrbit.cpp +++ b/core/lib/GNSSEph/BrcKeplerOrbit.cpp @@ -472,6 +472,17 @@ namespace gpstk return PRNID; } + ObsID BrcKeplerOrbit::getObsID() const + throw(InvalidRequest) + { + if(!dataLoaded) + { + InvalidRequest exc("Required data not stored."); + GPSTK_THROW(exc); + } + return obsID; + } + short BrcKeplerOrbit::getFullWeek() const throw(InvalidRequest) { diff --git a/core/lib/GNSSEph/BrcKeplerOrbit.hpp b/core/lib/GNSSEph/BrcKeplerOrbit.hpp index f8c2b6d49..871d872ef 100644 --- a/core/lib/GNSSEph/BrcKeplerOrbit.hpp +++ b/core/lib/GNSSEph/BrcKeplerOrbit.hpp @@ -167,6 +167,9 @@ namespace gpstk /** This function returns the PRN ID of the SV. */ short getPRNID() const throw(gpstk::InvalidRequest); + /** This function returns the OBS ID of the orbit. */ + ObsID getObsID() const throw(gpstk::InvalidRequest); + /** This function returns the health status of the SV. */ bool isHealthy() const throw(gpstk::InvalidRequest); diff --git a/core/lib/GNSSEph/ClockSatStore.cpp b/core/lib/GNSSEph/ClockSatStore.cpp index 0746d5a73..eb4ed14ff 100644 --- a/core/lib/GNSSEph/ClockSatStore.cpp +++ b/core/lib/GNSSEph/ClockSatStore.cpp @@ -84,7 +84,7 @@ namespace gpstk } // pull data out of the data table - int n,Nlow(Nhalf-1),Nhi(Nhalf),Nmatch(Nhalf); + size_t n,Nlow(Nhalf-1),Nhi(Nhalf),Nmatch(Nhalf); CommonTime ttag0(it1->first); vector times,biases,drifts,accels,sig_biases,sig_drifts,sig_accels; @@ -262,7 +262,7 @@ namespace gpstk } // pull data out of the data table - int n,Nhi(Nhalf); + size_t n,Nhi(Nhalf); CommonTime ttag0(it1->first); vector times,biases,drifts; diff --git a/core/lib/GNSSEph/EngEphemeris.cpp b/core/lib/GNSSEph/EngEphemeris.cpp index 56d1298c8..dd941dd82 100644 --- a/core/lib/GNSSEph/EngEphemeris.cpp +++ b/core/lib/GNSSEph/EngEphemeris.cpp @@ -317,6 +317,25 @@ namespace gpstk return true; } + bool EngEphemeris :: isValid() const + throw() + { + try + { + return ((PRNID >= 1) && (PRNID <= 37) && + (HOWtime[0] >= 0) && (HOWtime[0] <= 604784) && + (HOWtime[1] >= 0) && (HOWtime[1] <= 604784) && + (HOWtime[2] >= 0) && (HOWtime[2] <= 604784) && + (getToc() >= 0) && (getToc() <= 604784) && + (getToe() >= 0) && (getToe() <= 604784) && + (getEcc() >= 0) && (getEcc() <= 0.03)); + } + catch( ... ) + { + return false; + } + } + bool EngEphemeris::isData(short subframe) const throw( InvalidRequest ) { @@ -330,6 +349,15 @@ namespace gpstk return haveSubframe[subframe-1]; } + bool EngEphemeris :: isDataSet() const + { + if (haveSubframe[0] && haveSubframe[1] && haveSubframe[2]) + { + return ((IODC & 0xff) == (IODE & 0xff)); + } + return false; + } + void EngEphemeris::setAccuracy(const double& acc) throw( InvalidParameter ) { @@ -342,16 +370,19 @@ namespace gpstk orbit.setAccuracy(acc); } - /** - *This is for Block II/IIA - *Need update for Block IIR and IIF - */ short EngEphemeris :: getFitInterval() const - throw( InvalidRequest ) + throw(InvalidRequest) { - short iodc = getIODC(); - short fiti = getFitInt(); + return getFitInterval(getIODC(), getFitInt()); + } + /** + * This is for Block II/IIA + * Need update for Block IIR and IIF + */ + short EngEphemeris :: getFitInterval(short iodc, short fiti) + throw(InvalidRequest) + { /* check the IODC */ if (iodc < 0 || iodc > 1023) { diff --git a/core/lib/GNSSEph/EngEphemeris.hpp b/core/lib/GNSSEph/EngEphemeris.hpp index 86ef3af38..ac8fcbd66 100644 --- a/core/lib/GNSSEph/EngEphemeris.hpp +++ b/core/lib/GNSSEph/EngEphemeris.hpp @@ -150,6 +150,14 @@ namespace gpstk const short PRN, const short track); + /** + * Checks all quantities (present or not) to determine + * whether they fall within the effective range as described + * in the IS-GPS-200. + * @return true if all values are within their effective range. + */ + bool isValid() const throw(); + /** * Query presence of subframe in this object. * @param subframe subframe ID (1-3) to check. @@ -160,6 +168,15 @@ namespace gpstk bool isData(short subframe) const throw( gpstk::InvalidRequest ); + /** + * Return whether the ephemeris contains a complete data set, + * i.e. whether the ephemeris contains subframes 1-3 with matching + * IODC and IODE values. + * @return true if the ephemeris is a complete data set, + * false if a data set cutover has occured + */ + bool isDataSet() const; + /** * Set the value of the SV accuracy (in meters). This is the only * "set" method and is provided so that one can set the SV @@ -190,11 +207,20 @@ namespace gpstk short getFitInterval() const throw( gpstk::InvalidRequest ); + /** + * Static version of the above. + * @param iodc the IODC of the ephemeris. + * @param fiti the fit interval flag of same ephemeris. + * @return the fit interval in hours (0 = failure). + * @throw InvalidRequest if data is missing. + */ + static short getFitInterval(short iodc, short fiti) + throw(gpstk::InvalidRequest); + /** Compute satellite position & velocity at the given time * using this ephemeris. * @throw InvalidRequest if a required subframe has not been stored. */ - Xvt svXvt(const CommonTime& t) const throw( gpstk::InvalidRequest ); diff --git a/core/lib/GNSSEph/EngNav.cpp b/core/lib/GNSSEph/EngNav.cpp index f6776648c..1be148323 100644 --- a/core/lib/GNSSEph/EngNav.cpp +++ b/core/lib/GNSSEph/EngNav.cpp @@ -511,6 +511,120 @@ namespace gpstk return iret; } + + bool EngNav :: sv2page(short svpgid, short& subframe, short& page) + throw() + { + if (svpgid < 1) + return false; + + if ((svpgid >= 1) && (svpgid <= 24)) + { + subframe = 5; + page = svpgid; + return true; + } + + switch (svpgid) + { + case 51: + subframe = 5; + page = 25; + return true; + case 29: + case 30: + case 31: + case 32: + subframe = 4; + page = svpgid - 22; + return true; + case 25: + case 26: + case 27: + case 28: + subframe = 4; + page = svpgid - 23; + return true; + case 57: + subframe = 4; + page = 1; + return true; + case 55: + case 56: + case 60: + case 61: + case 62: + case 63: + subframe = 4; + page = svpgid - 38; + return true; + case 52: + case 53: + case 54: + case 58: + case 59: + subframe = 4; + page = svpgid - 39; + return true; + } + return false; + } + + + bool EngNav :: sfpage2svid(short subframe, short page, short& svpgid) + throw() + { + static const short sf4pg[25] = { 57, 25, 26, 27, 28, 57, 29, 30, 31, 32, + 57, 62, 52, 53, 54, 57, 55, 56, 58, 59, + 57, 60, 61, 62, 63 }; + + svpgid = 0; + + if ((page < 1) || (page > 25) || (subframe < 4) || (subframe > 5)) + return false; + + if (subframe == 4) + { + svpgid = sf4pg[page-1]; + } + else if (page == 25) + svpgid = 51; + else + svpgid = page; + + return true; + } + + + bool EngNav :: zcount2page(unsigned long zcount, + short& subframe, short& page) + throw() + { + subframe = ((zcount % 20) / 4); + if (subframe == 0) + subframe = 5; + unsigned long mod500 = zcount % 500; + + switch (subframe) + { + case 1: + case 2: + case 3: + page = 0; + break; + case 4: + page = ((mod500 - 12) / 20) + 1; + break; + case 5: + page = (mod500 > 0) ? ((mod500 - 16) / 20) + 1 : 25; + break; + default: + return false; + } + return true; + } + + uint32_t EngNav :: computeParity(uint32_t sfword, uint32_t psfword, bool knownUpright) diff --git a/core/lib/GNSSEph/EngNav.hpp b/core/lib/GNSSEph/EngNav.hpp index 483764b7f..113d2fa82 100644 --- a/core/lib/GNSSEph/EngNav.hpp +++ b/core/lib/GNSSEph/EngNav.hpp @@ -250,8 +250,55 @@ namespace gpstk throw(); static short getSubframePattern(const uint32_t input[10]) throw(); - static void dump(std::ostream& s = std::cout); - + + /** + * Given an SV/Page ID (1-63), set the subframe ID and page + * passed to the function. + * @param svpgid (input) the SV/Page ID to be translated + * (typically extracted from subframe 4/5, word 3, bits 3-8 + * (bit 1=MSB). + * @param subframe (output) the subframe ID of svpgid (4,5) + * @param page (output) the page number of svpgid (1-25) + * @return false if svpgid was invalid + * @note Some SV/Page IDs are redundant, so the result will + * be one of the possible pages for that SV/Page ID. + */ + static bool sv2page(short svpgid, short& subframe, short& page) + throw(); + + + /** + * Given an SV/Page ID (1-63), set the subframe ID and page + * passed to the function. + * @param subframe (input) the subframe ID of svpgid (4,5) + * @param page (input) the page number of svpgid (1-25) + * @param svpgid (output) the SV/Page ID translated from subframe/page + * @return false if svpgid was invalid + * @note Some SV/Page IDs are redundant, so the result will + * be one of the possible pages for that SV/Page ID. + */ + static bool sfpage2svid(short subframe, short page, short& svpgid) + throw(); + + + /** + * Given a Z-count representing the TOW in the HOW of a + * navigation subframe (i.e. TOW * 4), set the subframe ID + * and page passed to the function. + * @param zcount (input) the TOW count, in z-counts, of a nav subframe + * @param subframe (output) the subframe ID of svpgid (4,5) + * @param page (output) the page number of svpgid (1-25) + * @return false if zcount was invalid + */ + static bool zcount2page(unsigned long zcount, + short& subframe, short& page) + throw(); + + /** + * Emit human-readable instance data to the specified stream. + * @param s stream to which data will be written + */ + static void dump(std::ostream& s = std::cout); private: diff --git a/core/lib/GNSSEph/GPSEphemeris.hpp b/core/lib/GNSSEph/GPSEphemeris.hpp index c60d760b6..f194ce9f6 100644 --- a/core/lib/GNSSEph/GPSEphemeris.hpp +++ b/core/lib/GNSSEph/GPSEphemeris.hpp @@ -106,9 +106,9 @@ namespace gpstk /// Compute the fit duration in hours, and adjust the times of validity, given /// the fit interval flag. NB IODC must be set before calling /// @param fitint fit interval flag - void setFitIntervalFlag(const short fitint) + void setFitIntervalFlag(const short fitintFlag) { - fitDuration = getFitInterval(IODC, fitint); + fitDuration = getFitInterval(IODC, fitintFlag); adjustValidity(); } @@ -127,7 +127,6 @@ namespace gpstk short fitDuration; ///< duration of validity short fitint; ///< for RINEX - private: /// Get the fit interval in hours from the fit interval flag and the IODC static short getFitInterval(const short IODC, const short fitIntFlag); diff --git a/core/lib/GNSSEph/GloEphemeris.cpp b/core/lib/GNSSEph/GloEphemeris.cpp old mode 100644 new mode 100755 index a03f476bd..8179c6331 --- a/core/lib/GNSSEph/GloEphemeris.cpp +++ b/core/lib/GNSSEph/GloEphemeris.cpp @@ -64,6 +64,12 @@ namespace gpstk GPSTK_THROW(e); } + Xvt retVal = svXvtOverrideFit(epoch); + return retVal; + } + + Xvt GloEphemeris::svXvtOverrideFit(const CommonTime& epoch) const + { // Values to be returned will be stored here Xvt sv; @@ -410,9 +416,9 @@ namespace gpstk // Get the Julian Day at 0 hours UT (jd) YDSTime ytime( time ); - double year( ytime.year ); + double year( static_cast(ytime.year) ); int doy( ytime.doy ); - int temp( floor(365.25 * (year - 1.0)) + doy ); + int temp( static_cast(floor(365.25 * (year - 1.0))) + doy ); double jd( static_cast(temp)+ 1721409.5 ); diff --git a/core/lib/GNSSEph/GloEphemeris.hpp b/core/lib/GNSSEph/GloEphemeris.hpp old mode 100644 new mode 100755 index c25f64a73..620ed7dfe --- a/core/lib/GNSSEph/GloEphemeris.hpp +++ b/core/lib/GNSSEph/GloEphemeris.hpp @@ -89,6 +89,17 @@ namespace gpstk Xvt svXvt(const CommonTime& epoch) const throw( gpstk::InvalidRequest ); + /** Compute satellite position & velocity at the given time + * using this ephemeris data. HOWEVER, DO NOT check whether + * the requested time is in the fit interval for this data set. + * + * THIS IS ONLY INTENDED FOR SPECIAL TEST PURPOSES. GENERAL + * USE IS STRONGLY DISCOURAGED. + * + * @param epoch Epoch to compute position and velocity. + * + */ + Xvt svXvtOverrideFit(const CommonTime& epoch) const; /// Get the epoch time for this ephemeris CommonTime getEphemerisEpoch() const diff --git a/core/lib/GNSSEph/PositionSatStore.cpp b/core/lib/GNSSEph/PositionSatStore.cpp index d0960dca4..f97cce87d 100644 --- a/core/lib/GNSSEph/PositionSatStore.cpp +++ b/core/lib/GNSSEph/PositionSatStore.cpp @@ -106,7 +106,7 @@ namespace gpstk } // pull data out of the data table - int n,Nlow(Nhalf-1),Nhi(Nhalf),Nmatch(Nhalf); + size_t n,Nlow(Nhalf-1),Nhi(Nhalf),Nmatch(Nhalf); CommonTime ttag0(it1->first); vector times,P[3],V[3],A[3],sigP[3],sigV[3],sigA[3]; diff --git a/core/lib/GNSSEph/RinexObsID.cpp b/core/lib/GNSSEph/RinexObsID.cpp index eb1f5920e..80f0c611b 100644 --- a/core/lib/GNSSEph/RinexObsID.cpp +++ b/core/lib/GNSSEph/RinexObsID.cpp @@ -132,7 +132,7 @@ namespace gpstk // described in the Rinex 3 specification. bool isValidRinexObsID(const std::string& strID) { - int i(strID.length()-3); + int i(static_cast(strID.length())-3); if(i < 0 || i > 1) return false; diff --git a/core/lib/Math/Matrix/MatrixBase.hpp b/core/lib/Math/Matrix/MatrixBase.hpp index ce5cec49f..a48a20c0e 100644 --- a/core/lib/Math/Matrix/MatrixBase.hpp +++ b/core/lib/Math/Matrix/MatrixBase.hpp @@ -172,6 +172,18 @@ namespace gpstk return toReturn; } + /// copies out diagonal into a vector + Vector diagCopy(void) const + throw(MatrixException) + { + size_t i, n(cols()); + if(rows() < n) n = rows(); + Vector toReturn(n); + for(i=0; i class LUDecomp { @@ -427,7 +428,7 @@ namespace gpstk GPSTK_THROW(e); } - size_t N=m.rows(),i,j,k,imax=0; + size_t N=m.rows(),i,j,k,n,imax; T big,t,d; Vector V(N,T(0)); @@ -486,8 +487,8 @@ namespace gpstk } } // end LUDecomp() - // Compute inverse(m)*v, where *this is LUD(m), via back substitution - // Solution overwrites input Vector v + /// Compute inverse(m)*v, where *this is LUD(m), via back substitution + /// Solution overwrites input Vector v template void backSub(RefVectorBase& v) const throw (MatrixException) @@ -525,18 +526,18 @@ namespace gpstk inline T det(void) throw(MatrixException) { - T d(parity); + T d(static_cast(parity)); for(size_t i=0; i LU; - /// The pivot array - Vector Pivot; - /// Parity - int parity; + /// The matrix in LU-decomposed form: L and U together; + /// all diagonal elements of L are implied 1. + Matrix LU; + /// The pivot array + Vector Pivot; + /// Parity + int parity; }; // end class LUDecomp @@ -752,7 +753,7 @@ namespace gpstk if(v(j) > T(0)) sum = -sum; A(j,j) = sum; v(j) = v(j) - sum; - sum = 1/(sum*v(j)); + sum = T(1)/(sum*v(j)); // loop over columns beyond j for(k=j+1; k - inline T condNum(const ConstMatrixBase& m, T& big, T& small) + inline T condNum(const ConstMatrixBase& m, T& bigNum, T& smallNum) throw () { SVD svd; svd(m); // SVD will not always sort singular values in descending order svd.sort(true); - big = svd.S(0); - small = svd.S(svd.S.size()-1); - if(small <= std::numeric_limits::epsilon()) + bigNum = svd.S(0); + smallNum = svd.S(svd.S.size()-1); + if(smallNum <= std::numeric_limits::epsilon()) return T(0); - return big/small; + return bigNum/smallNum; } /** - * returns the condition number of the matrix, doesnt require big or small.. + * returns the condition number of the matrix, doesnt require bigNum or smallNum.. */ template inline T condNum(const ConstMatrixBase& m) throw () { - T big, small; - return condNum(m, big, small); + T bigNum, smallNum; + return condNum(m, bigNum, smallNum); } /** @@ -677,7 +677,7 @@ namespace gpstk */ template inline Matrix inverseSVD(const ConstMatrixBase& m, - T& big, T& small, const T tol=T(1.e-8)) throw (MatrixException) + T& bigNum, T& smallNum, const T tol=T(1.e-8)) throw (MatrixException) { if ((m.rows() != m.cols()) || (m.cols() == 0)) { MatrixException e("inverseSVD() requires non-trivial square matrix"); @@ -695,9 +695,9 @@ namespace gpstk GPSTK_THROW(e); } - // compute condition number = big/small - big = svd.S(0); - small = svd.S(svd.S.size()-1); + // compute condition number = bigNum/smallNum + bigNum = svd.S(0); + smallNum = svd.S(svd.S.size()-1); // edit singular values using input tolerance, output edited SVs for(i=1; i= year and rec.month >= month // watch out - cannot use CommonTime here - int iday(day); - double dday(iday-int(day)); + int iday(static_cast(day)); + double dday(static_cast(iday-int(day))); if(iday == 0) { iday = 1; dday = 1.0-dday; } long JD0 = convertCalendarToJD(year,month,iday); long JD = convertCalendarToJD(preleap[i].year,preleap[i].month,1); diff --git a/core/lib/TimeHandling/GPSWeekSecond.hpp b/core/lib/TimeHandling/GPSWeekSecond.hpp index 748e7168c..75e0fda88 100644 --- a/core/lib/TimeHandling/GPSWeekSecond.hpp +++ b/core/lib/TimeHandling/GPSWeekSecond.hpp @@ -88,6 +88,38 @@ namespace gpstk return e; } + /// @defgroup wsco WeekSecond Comparison Operators + /// All comparison operators have a parameter "right" which corresponds + /// to the GPSWeekSecond object to the right of the symbol. + /// All comparison operators are const and return true on success + /// and false on failure. + //@{ + inline bool operator==( const GPSWeekSecond& right ) const + { + return WeekSecond::operator==( right ); + } + inline bool operator!=( const GPSWeekSecond& right ) const + { + return WeekSecond::operator!=( right ); + } + inline bool operator<( const GPSWeekSecond& right ) const + { + return WeekSecond::operator<( right ); + } + inline bool operator>( const GPSWeekSecond& right ) const + { + return WeekSecond::operator>( right ); + } + inline bool operator<=( const GPSWeekSecond& right ) const + { + return WeekSecond::operator<=( right ); + } + inline bool operator>=( const GPSWeekSecond& right ) const + { + return WeekSecond::operator>=( right ); + } + //@} + /// Return a string containing the characters that this class /// understands when printing times. virtual std::string getPrintChars() const diff --git a/core/lib/TimeHandling/JulianDate.cpp b/core/lib/TimeHandling/JulianDate.cpp index efed41fe7..6a6a1cbe7 100644 --- a/core/lib/TimeHandling/JulianDate.cpp +++ b/core/lib/TimeHandling/JulianDate.cpp @@ -171,7 +171,7 @@ namespace gpstk timeSystem != right.timeSystem) return false; - if( fabs(jd - right.jd) < CommonTime::eps ) + if( std::abs(jd - right.jd) < CommonTime::eps ) { return true; } diff --git a/core/lib/Utilities/BinUtils.hpp b/core/lib/Utilities/BinUtils.hpp index 6cecb0921..8fa465b21 100644 --- a/core/lib/Utilities/BinUtils.hpp +++ b/core/lib/Utilities/BinUtils.hpp @@ -87,7 +87,8 @@ namespace gpstk * double. * @param p object whose bytes are to be reversed. */ - template void twiddle(T& p) + template + inline void twiddle(T& p) throw() { unsigned char *front = (unsigned char*)&p; @@ -109,7 +110,8 @@ namespace gpstk * @param p the object whose bytes are to be modified. * @return a new object which is in Intel byte ordering. */ - template T intelToHost(const T& p) + template + inline T intelToHost(const T& p) throw() { T temp(p); @@ -124,7 +126,8 @@ namespace gpstk * @param p the object whose bytes are to be modified * @return a new object which is in host byte ordering. */ - template T hostToIntel(const T& p) + template + inline T hostToIntel(const T& p) throw() { T temp(p); @@ -139,7 +142,8 @@ namespace gpstk * @param p the object whose bytes are to be modified. * @return a new object which is in network byte order. */ - template T netToHost(const T& p) + template + inline T netToHost(const T& p) throw() { T temp(p); @@ -154,7 +158,8 @@ namespace gpstk * @param p the object whose bytes are to be modified. * @return a new object which is in host byte order. */ - template T hostToNet(const T& p) + template + inline T hostToNet(const T& p) throw() { T temp(p); @@ -164,31 +169,34 @@ namespace gpstk return temp; } - /** - * Remove (optionally) the item specified from the string and convert it + /** + * Decode the item specified from the string and convert it * from network byte order to host byte order. * @param str the string from which to obtain data. - * @param pos an offset into the string to pull the data from. If this - * value is specified, the item is not removed from the string. + * @param pos offset into the string from which to pull the data. * @warn This function does not check for appropriate string length. */ template - T decodeVar( std::string& str, std::string::size_type pos = std::string::npos) + inline T decodeVar( const std::string& str, + std::string::size_type pos ) { T t; char *cp = reinterpret_cast( &t ); + str.copy( cp, sizeof(T), pos ); + return gpstk::BinUtils::netToHost( t ); + } - if (pos == std::string::npos) - { - str.copy( cp, sizeof(T) ); - t = gpstk::BinUtils::netToHost( t ); - str.erase( 0, sizeof(T) ); - } - else - { - str.copy( cp, sizeof(T) , pos); - t = gpstk::BinUtils::netToHost( t ); - } + /** + * Decode and remove the item specified from the head of the string + * and convert it from network byte order to host byte order. + * @param str the string from which to obtain data. + * @warn This function does not check for appropriate string length. + */ + template + inline T decodeVar( std::string& str ) + { + T t = gpstk::BinUtils::decodeVar(str, 0); + str.erase( 0, sizeof(T) ); return t; } @@ -198,7 +206,7 @@ namespace gpstk * @param v the object of type T to convert to a string. */ template - std::string encodeVar( const T& v ) + inline std::string encodeVar( const T& v ) { T tmp = v; tmp = gpstk::BinUtils::hostToNet( v ); @@ -389,9 +397,9 @@ namespace gpstk { // Stolen from http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel uint32_t c; // store the total here - const int S[] = {1, 2, 4, 8, 16}; // Magic Binary Numbers - const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, - 0x0000FFFF}; + static const int S[] = {1, 2, 4, 8, 16}; // Magic Binary Numbers + static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, + 0x0000FFFF}; // ...and if we were to turn this into a loop, it would // totally defeat the purpose. The point here is to be diff --git a/core/lib/Utilities/Exception.hpp b/core/lib/Utilities/Exception.hpp index e8a86f878..2321e2996 100644 --- a/core/lib/Utilities/Exception.hpp +++ b/core/lib/Utilities/Exception.hpp @@ -365,6 +365,11 @@ namespace gpstk #define GPSTK_RETHROW(exc) { exc.addLocation(FILE_LOCATION); throw; } #endif +/// Provide an "ASSERT" type macro +#define GPSTK_ASSERT(CONDITION) if (!(CONDITION)) { \ + gpstk::AssertionFailure exc("Assertion failed: " #CONDITION); \ + GPSTK_THROW(exc); \ + } /** diff --git a/core/lib/Utilities/StringUtils.hpp b/core/lib/Utilities/StringUtils.hpp index e6d47a1ef..ea9f338b8 100644 --- a/core/lib/Utilities/StringUtils.hpp +++ b/core/lib/Utilities/StringUtils.hpp @@ -1304,81 +1304,27 @@ namespace gpstk } /** Split a string by some delimiters - * @param aStr the string to be splitted + * @param aStr the string to be split * @param theDelimiters the delimiters to split the string * @param trimWhitespace will trim the token string, default is false * @param ignoreEmpty will ignore the empty tokens, default is true */ inline std::vector split(const std::string& aStr, - const std::string& theDelimiters=" ", + const std::string& theDelimiters, bool trimWhitespace = false, - bool ignoreEmpty = true) - { - std::vector toReturn; - - std::string::size_type lastPos = aStr.find_first_not_of(theDelimiters, 0); - std::string::size_type pos = aStr.find_first_of(theDelimiters, lastPos); - - while (std::string::npos != pos || std::string::npos != lastPos) - { - std::string token = aStr.substr(lastPos, pos - lastPos); - - if(trimWhitespace) token = StringUtils::strip(token); - - if(!token.empty() || !ignoreEmpty) toReturn.push_back(token); - - lastPos = aStr.find_first_not_of(theDelimiters, pos); - pos = aStr.find_first_of(theDelimiters, lastPos); - } - - return toReturn; - } - - /** Split a string by whitespace, respecting single and double quotes - * @param aStr the string to be splitted - * @param trimWhitespace will trim the token string, default is false - * @param ignoreEmpty will ignore the empty tokens, default is true - */ - inline std::vector splitOnWhitespace(const std::string& aStr, - bool trimWhitespace = false, - bool ignoreEmpty = true) - { - std::vector toReturn; - std::string::size_type begPos = 0; - std::string::size_type endPos = 0; - std::string::size_type tokenLength = 0; - std::string currentDelimiter = " "; - - while (std::string::npos != endPos && aStr.length() != endPos) - { - if ( aStr.compare(begPos,1,"\"") == 0 || aStr.compare(begPos,1,"\'") == 0) - { - // if the current char is a quote, use it as the current delimiter - currentDelimiter = aStr[begPos]; - } - endPos = aStr.find_first_of(currentDelimiter, begPos+1); - - if (currentDelimiter.compare(0,1," ") != 0 - && aStr.length() != endPos - && std::string::npos != endPos) - { - // if this token is quoted, make sure to capture the trailing quote - endPos++; - } - tokenLength = endPos - begPos; - - std::string token = aStr.substr(begPos, tokenLength); - - if(trimWhitespace) token = gpstk::StringUtils::strip(token); - - if(!token.empty() || !ignoreEmpty) toReturn.push_back(token); - - // find the next token - begPos = endPos+1; - } - - return toReturn; - } + bool ignoreEmpty = true); + + /// Split a string on the given delimiter, respecting fields enclosed by + /// a pair of either single or double quotes. Quotes are removed in output, + /// and optionally also leading and trailing whitespace. + /// @param aStr the string to be split + /// @param delimiter character delimiter (not ' or ") + /// @param trimWhitespace will trim the token string, default is true + /// @param ignoreEmpty will ignore the empty tokens, default is true + inline std::vector splitWithQuotes(const std::string& aStr, + const char delimiter = ' ', + bool trimWhitespace = true, + bool ignoreEmpty = true); } // namespace StringUtils @@ -1561,15 +1507,15 @@ namespace gpstk { try { - std::string::size_type pos = s.length() - aString.length(); - - // empty string, etc. - if ((pos > s.length()) || (aString == "")) + // empty string, etc.; cannot let (size_type) pos = negative + if (s.length() < aString.length() || (aString == "")) return s; + std::string::size_type pos = s.length() - aString.length(); + while((num > 0) && - (s.rfind(aString,pos) == pos) && - (s.length() > 0)) + (s.length() >= aString.length()) && + (s.rfind(aString,pos) == pos)) { s.erase(pos, std::string::npos); --num; @@ -1624,7 +1570,8 @@ namespace gpstk return rv; } - inline std::string change(const std::string& aString, const std::string& inputString, + inline std::string change(const std::string& aString, + const std::string& inputString, const std::string& outputString, std::string::size_type startPos, unsigned numChanges) { @@ -1637,7 +1584,7 @@ namespace gpstk const std::string& outputString, std::string::size_type startPos, unsigned numChanges) { - unsigned count = 0; + unsigned count = 0; std::string::size_type opos = startPos; while (count < numChanges) @@ -2342,8 +2289,9 @@ namespace gpstk startPos = pos; // get first delimter after word wordNum pos = s.find(delimiter, pos); - if (((int)numWords != -1) && ((int)wordNum == (int)(firstWord + (numWords-1)))) - break; + if (((int)numWords != -1) + && ((int)wordNum == (int)(firstWord + (numWords-1)))) + break; pos = s.find_first_not_of(delimiter, pos); wordNum++; } @@ -2409,6 +2357,85 @@ namespace gpstk } } + inline std::vector split(const std::string& aStr, + const std::string& theDelimiters, + bool trimWhitespace, + bool ignoreEmpty) + { + std::vector toReturn; + + std::string::size_type lastPos = aStr.find_first_not_of(theDelimiters, 0); + std::string::size_type pos = aStr.find_first_of(theDelimiters, lastPos); + + while (std::string::npos != pos || std::string::npos != lastPos) + { + std::string token = aStr.substr(lastPos, pos - lastPos); + + if(trimWhitespace) token = StringUtils::strip(token); + + if(!token.empty() || !ignoreEmpty) toReturn.push_back(token); + + lastPos = aStr.find_first_not_of(theDelimiters, pos); + pos = aStr.find_first_of(theDelimiters, lastPos); + } + + return toReturn; + } + + inline std::vector splitWithQuotes(const std::string& aStr, + const char delimiter, + bool trimWhitespace, + bool ignoreEmpty) + { + std::vector toReturn; + std::string::size_type begPos = 0; + std::string::size_type endPos = 0; + std::string::size_type tokenLength; + char currentDelimiter; + + if(delimiter == '\'' || delimiter == '"') + GPSTK_THROW(StringException("Delimiter must not be quote")); + + while(endPos != std::string::npos && endPos <= aStr.length()) + { + currentDelimiter = delimiter; + + // if first character is a quote, set current delimiter to it + if(aStr.compare(begPos,1,"\"") == 0) currentDelimiter = '"'; + if(aStr.compare(begPos,1,"\'") == 0) currentDelimiter = '\''; + + // find next delimiter + endPos = aStr.find_first_of(currentDelimiter, + begPos + (currentDelimiter == delimiter ? 0 : 1)); + + // if this token is quoted, make sure to capture the trailing quote + // if(delimiter is a quote and second quote is found) include it + if(currentDelimiter != delimiter && std::string::npos != endPos) endPos++; + + // length of new field + tokenLength = endPos - begPos; + // copy out the field + std::string token = aStr.substr(begPos, tokenLength); + + // if quoted, remove the quotes + if(currentDelimiter != delimiter) + token = gpstk::StringUtils::strip(token,currentDelimiter); + + // remove whitespace at beginning and end + if(trimWhitespace) token = gpstk::StringUtils::strip(token); + + // save it + if(!token.empty() || !ignoreEmpty) toReturn.push_back(token); + + // find the next token, and go back to delimiter + begPos = endPos; + if(begPos != std::string::npos) begPos++; + endPos = begPos; + } + + return toReturn; + } + inline std::string& removeWords(std::string& s, const std::string::size_type first, const std::string::size_type wordsToReplace, diff --git a/core/tests/ClockModel/CMakeLists.txt b/core/tests/ClockModel/CMakeLists.txt index 09b2bb388..7350bbd8a 100644 --- a/core/tests/ClockModel/CMakeLists.txt +++ b/core/tests/ClockModel/CMakeLists.txt @@ -12,9 +12,9 @@ add_test(ClockModel_ObsClockModel ObsClockModel_T) # target_link_libraries(ObsEpochMap_T gpstk) # add_test(ClockModel_ObsEpochMap ObsEpochMap_T) -# add_executable(ObsRngDev_T ObsRngDev_T.cpp) -# target_link_libraries(ObsRngDev_T gpstk) -# add_test(ClockModel_ObsRngDev ObsRngDev_T) +add_executable(ObsRngDev_T ObsRngDev_T.cpp) +target_link_libraries(ObsRngDev_T gpstk) +add_test(ClockModel_ObsRngDev ObsRngDev_T) # add_executable(ORDEpoch_T ORDEpoch_T.cpp) # target_link_libraries(ORDEpoch_T gpstk) diff --git a/core/tests/ClockModel/EpochClockModel_T.cpp b/core/tests/ClockModel/EpochClockModel_T.cpp index 218c4ced8..db904c57d 100644 --- a/core/tests/ClockModel/EpochClockModel_T.cpp +++ b/core/tests/ClockModel/EpochClockModel_T.cpp @@ -1,11 +1,58 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#include "EpochClockModel.hpp" #include "TestUtil.hpp" #include class EpochClockModel_T { - public: - EpochClockModel_T(){}// Default Constructor, set the precision value - ~EpochClockModel_T() {} // Default Desructor + public: + EpochClockModel_T(){}// Default Constructor, set the precision value + ~EpochClockModel_T() {} // Default Desructor + + int initializationIdontKnoworCare(void) + { + TestUtil testFramework("EpochClockModel", "initializationIdontKnoworCare", __FILE__, __LINE__); + + gpstk::Orbi + } + + + }; diff --git a/core/tests/ClockModel/ObsRngDev_T.cpp b/core/tests/ClockModel/ObsRngDev_T.cpp index 5cf35baef..4c80f1351 100644 --- a/core/tests/ClockModel/ObsRngDev_T.cpp +++ b/core/tests/ClockModel/ObsRngDev_T.cpp @@ -1,15 +1,883 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#include "ObsRngDev.hpp" #include "TestUtil.hpp" #include +#include "RinexEphemerisStore.hpp" + +#include "EphemerisRange.hpp" + +//===================================================================================== +// Test Structure +// Begin with generating ObsRngDev objects using every constructor and test the basic +// initialization of these objects. Then verify that each of the objects constructed have +// calculated the ORD correctly, in addition to the elevation and azimuth. By testing +// the value of the ORD, the different calculations such as generating Tropospheric models +// and calculating ionospheric and tropospheric delays are tested implicitly. These tests +// are entirely dependent on the Ephemeris Range class calculating the range correctly. +//====================================================================================== + +gpstk::IonoModelStore ionoModelStoreGen(std::vector& cTimeVec) +{ + double a[] = {1,2,3,4}; double b[] = {4,3,2,1}; + + gpstk::IonoModelStore ims; + + for (int i=0; i < cTimeVec.size(); i++) + ims.addIonoModel(cTimeVec[i], gpstk::IonoModel(a,b)); + + return ims; +} + class ObsRngDev_T { - public: - ObsRngDev_T(){}// Default Constructor, set the precision value - ~ObsRngDev_T() {} // Default Desructor + public: + ObsRngDev_T(){ eps = 1E-12; floatPrecision = 1E-6; }// Default Constructor, set the precision value to 6 digits due to float + ~ObsRngDev_T() {} // Default Destructor + + void initialization(void) + { + receiverPos.setGeodetic(30.387577, -97.727607, 240); + + prange.push_back(21665483.747); prange.push_back(21662553.318); prange.push_back(21659650.826); + prange2.push_back(21665487.640); prange2.push_back(21662557.419); prange2.push_back(21659655.019); + + id.id = 1; + id.system = gpstk::SatID::systemGPS; + + gpstk::CommonTime ct1 = gpstk::CivilTime(2006, 1, 31, 2, 0, 0, gpstk::TimeSystem::GPS).convertToCommonTime(); + gpstk::CommonTime ct2 = gpstk::CivilTime(2006, 1, 31, 4, 0, 0, gpstk::TimeSystem::GPS).convertToCommonTime(); + gpstk::CommonTime ct3 = gpstk::CivilTime(2006, 1, 31, 6, 0, 0, gpstk::TimeSystem::GPS).convertToCommonTime(); + cTimeVec.push_back(ct1); + cTimeVec.push_back(ct2); + cTimeVec.push_back(ct3); + + std::string path = gpstk::getPathData() + "/test_input_rinex_nav_ephemerisData.031"; + ephemStore.loadFile(path); + } + + +//================================================================================= +// Begin Constructor Tests +//================================================================================= + + int BasicConstructorTest(void) + { + TestUtil testFramework("ObsRngDev", "BasicConstructor", __FILE__, __LINE__); + + //same prn for different ranges & different time + testMesg = "Generation of ORDs with the basic constructor failed"; + try + { + for (int i=0; i < cTimeVec.size(); i++) + { + gpstk::ObsRngDev ord(prange[i], id, cTimeVec[i], receiverPos, ephemStore, em); + ordVec.push_back(ord); + } + testFramework.assert(true, testMesg, __LINE__); + } + catch(gpstk::Exception e) + { + std::cout< prange; + std::vector prange2; + + std::vector ordVec; + std::vector ordVecIon; + std::vector ordVecTrop; + std::vector ordVecTropIon; + std::vector ordVecGamma; + std::vector ordVecTropGamma; + + std::vector< std::map > prnPrange; + std::vector cTimeVec; + gpstk::Position receiverPos; + gpstk::RinexEphemerisStore ephemStore; + gpstk::WGS84Ellipsoid em; }; int main() //Main function to initialize and run all tests above { - return 0; //Return the total number of errors + int check = 0, errorCounter = 0; + ObsRngDev_T testClass; + + testClass.initialization(); + + check = testClass.BasicConstructorTest(); + errorCounter += check; + + check = testClass.IonosphericConstructorTest(); + errorCounter += check; + + check = testClass.TroposphericConstructorTest(); + errorCounter += check; + + check = testClass.IonosphericTroposphericConstructorTest(); + errorCounter += check; + + check = testClass.GammaConstructorTest(); + errorCounter += check; + + check = testClass.GammaTroposphericConstructorTest(); + errorCounter += check; + + check = testClass.getFunctionsTest(); + errorCounter += check; + + check = testClass.BasicCalculationTest(); + errorCounter += check; + + check = testClass.IonosphericCalculationTest(); + errorCounter += check; + + check = testClass.TroposphericCalculationTest(); + errorCounter += check; + + check = testClass.IonosphericTroposphericCalculationTest(); + errorCounter += check; + + check = testClass.GammaCalculationTest(); + errorCounter += check; + + check = testClass.TroposphericGammaCalculationTest(); + errorCounter += check; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; + + return errorCounter; //Return the total number of errors } diff --git a/core/tests/FileHandling/CMakeLists.txt b/core/tests/FileHandling/CMakeLists.txt index 55b50666e..5b0ac53b6 100644 --- a/core/tests/FileHandling/CMakeLists.txt +++ b/core/tests/FileHandling/CMakeLists.txt @@ -32,9 +32,17 @@ add_executable(RinexObs_T RinexObs_T.cpp) target_link_libraries(RinexObs_T gpstk) add_test(FileHandling_RinexObs_T RinexObs_T) -# add_executable(RinexClock_T RinexClock_T.cpp) -# target_link_libraries(RinexClock_T gpstk) -# add_test(FileHandling_RinexClock RinexClock_T) +add_executable(Rinex3Obs_T Rinex3Obs_T.cpp) +target_link_libraries(Rinex3Obs_T gpstk) +add_test(FileHandling_Rinex3Obs_T Rinex3Obs_T) + +add_executable(Rinex3Nav_T Rinex3Nav_T.cpp) +target_link_libraries(Rinex3Nav_T gpstk) +add_test(FileHandling_Rinex3Nav_T Rinex3Nav_T) + +add_executable(Rinex3Clock_T Rinex3Clock_T.cpp) +target_link_libraries(Rinex3Clock_T gpstk) +add_test(FileHandling_Rinex3Clock Rinex3Clock_T) # add_executable(SP3_T SP3_T.cpp) # target_link_libraries(SP3_T gpstk) diff --git a/core/tests/FileHandling/Rinex3Clock_T.cpp b/core/tests/FileHandling/Rinex3Clock_T.cpp new file mode 100644 index 000000000..dc623746b --- /dev/null +++ b/core/tests/FileHandling/Rinex3Clock_T.cpp @@ -0,0 +1,380 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#include "TestUtil.hpp" +#include + +#include "Rinex3ClockHeader.hpp" +#include "Rinex3ClockData.hpp" +#include "Rinex3ClockStream.hpp" + +#include "build_config.h" + +class Rinex3Clock_T +{ + public: + Rinex3Clock_T() {} // Default Constructor, set the precision value + ~Rinex3Clock_T() {} // Default Destructor + + + void init(void); + void toRinex3(void); + int headerExceptionTest(void); + int hardCodeTest(void); + int dataExceptionTest(void); + int filterOperatorsTest(void); + + private: + std::string dataFilePath; + std::string tempFilePath; + + std::string dataBadEpochLine; + std::string dataIncompleteHeader; + std::string dataInvalidLineLength; + std::string dataNotAClockFile; + std::string dataRinexClockFile; + std::string dataUnknownHeaderLabel; + + std::string dataTestOutput; + + std::string testMesg; + bool fileEqual; + +}; + +// Initialize data file names +void Rinex3Clock_T::init(void) +{ + TestUtil testFramework; + dataFilePath = testFramework.getDataPath(); + tempFilePath = testFramework.getTempPath(); + + std::cout<<"Running tests for Rinex v.2 files"<> ch; + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } +*/ + //--------------------------------------------------------------------- + msg_desc = "IncompleteHeader test"; + try + { + IncompleteHeader >> ch; //Not valid but doesn't throw errors + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } + + //--------------------------------------------------------------------- + msg_desc = "InvalidLineLength test"; + try + { + InvalidLineLength >> ch; + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } + + //--------------------------------------------------------------------- + msg_desc = "NotAClockFile test"; + try + { + NotAClockFile >> ch; + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } + + //--------------------------------------------------------------------- + msg_desc = "UnknownHeaderLabel test"; + try + { + UnknownHeaderLabel >> ch; + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } + + + } + catch(gpstk::Exception e) + { + testFramework.assert(false, "Error thrown when running headerExceptionTest: "+e.what(), __LINE__); + } + catch(...) + { + testFramework.assert(false, "Unknown error thrown when running headerExceptionTest", __LINE__); + } + + return testFramework.countFails(); +} + +int Rinex3Clock_T::dataExceptionTest(void) +{ + TestUtil testFramework("RinexClockStream", "DataExceptions", __FILE__, __LINE__); + + std::string msg_desc = ""; + std::string msg_expect = ", should throw gpstk::Exception"; + std::string msg_falsePass = " but threw no exception."; + std::string msg_trueFail = " but instead threw an unknown exception"; + + try + { + gpstk::Rinex3ClockStream BadEpochLine(dataBadEpochLine.c_str()); + + gpstk::Rinex3ClockData cd; + + msg_desc = "BadEpochLine test"; + try + { + while (BadEpochLine >> cd); + testFramework.assert(false, msg_desc + msg_expect + msg_falsePass, __LINE__); + } + catch(gpstk::Exception e) + { + testFramework.assert(true, msg_desc + msg_expect, __LINE__); + } + catch(...) + { + testFramework.assert(false, msg_desc + msg_expect + msg_trueFail, __LINE__); + } + + } + catch(gpstk::Exception e) + { + testFramework.assert(false, "Error thrown when running dataExceptionTest: "+e.what(), __LINE__); + } + catch(...) + { + testFramework.assert(false, "Unknown error thrown when running dataExceptionTest", __LINE__); + } + + return testFramework.countFails(); +} + +//Test that reading/writing out the file doesn't change it +int Rinex3Clock_T::hardCodeTest(void) +{ + TestUtil testFramework("RinexClockStream", "Read & write to file", __FILE__, __LINE__); + + gpstk::Rinex3ClockHeader ch; + gpstk::Rinex3ClockData cd; + + try + { + gpstk::Rinex3ClockStream inputStream(dataRinexClockFile.c_str()); + testFramework.assert(true, testMesg, __LINE__); + } + catch (gpstk::Exception e) + { + testMesg = "Input stream failed to open: " + e.what(); + testFramework.assert(false, testMesg, __LINE__); + } + + try + { + gpstk::Rinex3ClockStream outputStream(dataTestOutput.c_str()); + testFramework.assert(true, testMesg, __LINE__); + } + catch (gpstk::Exception e) + { + testMesg = "Output stream failed to open: " + e.what(); + testFramework.assert(false, testMesg, __LINE__); + } + + gpstk::Rinex3ClockStream inputStream; + gpstk::Rinex3ClockStream outputStream; + + try + { + inputStream.open(dataRinexClockFile.c_str(), std::ios::in); + outputStream.open(dataTestOutput.c_str(), std::ios::out); + inputStream >> ch; + // ch.dump(std::cout); + outputStream << ch; + while(inputStream >> cd) + { + // cd.dump(std::cout); + outputStream << cd; + } + + testFramework.assert(true, testMesg, __LINE__); + } + catch (gpstk::Exception e) + { + testMesg = "Unable to read/write to file stream: " + e.what(); + testFramework.assert(false, testMesg, __LINE__); + } + + fileEqual = false; + + int skipLines = 2; //First two lines of the header are not supposed to match + + fileEqual = testFramework.fileEqualTest(dataRinexClockFile, + dataTestOutput, skipLines); + + testMesg = "Files are not consistent after input & out"; + testFramework.assert(fileEqual, testMesg, __LINE__); + + return testFramework.countFails(); +} + + +int main(void) //Main function to initialize and run all tests above +{ + Rinex3Clock_T testClass; + int check, errorCounter = 0; + + testClass.init(); + + check = testClass.headerExceptionTest(); + errorCounter += check; + + check = testClass.dataExceptionTest(); + errorCounter += check; + + check = testClass.hardCodeTest(); + errorCounter += check; + + //Run all tests for Rinex v.3 files + testClass.toRinex3(); + + check = testClass.headerExceptionTest(); + errorCounter += check; + + check = testClass.dataExceptionTest(); + errorCounter += check; + + check = testClass.hardCodeTest(); + errorCounter += check; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; + + return errorCounter; //Return the total number of errors +} diff --git a/core/tests/FileHandling/Rinex3Nav_T.cpp b/core/tests/FileHandling/Rinex3Nav_T.cpp new file mode 100644 index 000000000..984985c62 --- /dev/null +++ b/core/tests/FileHandling/Rinex3Nav_T.cpp @@ -0,0 +1,706 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + + + +#include "Rinex3NavHeader.hpp" +#include "Rinex3NavData.hpp" +#include "Rinex3NavStream.hpp" +#include "Rinex3NavFilterOperators.hpp" + +#include "StringUtils.hpp" +#include "Exception.hpp" +#include "RinexEphemerisStore.hpp" + +#include "build_config.h" + +#include "TestUtil.hpp" +#include +#include + +using namespace gpstk; + +//============================================================================= +// Class declarations +//============================================================================= + +class Rinex3Nav_T +{ + + public: + + // constructor + Rinex3Nav_T() + { + init(); + } + // destructor + ~Rinex3Nav_T( ){} + + void init( void ); + + void toRinex3(void); + + // return values indicate number of failures, i.e., 0=PASS, 0!=FAIL + int hardCodeTest( void ); + int headerExceptionTest( void ); + int streamReadWriteTest( void ); + int filterOperatorsTest( void ); + + void toConversionTest(void); + int version2ToVersion3Test( void ); + int version3ToVersion2Test( void ); + + private: + + std::string dataFilePath; + std::string tempFilePath; + std::string file_sep; + + std::string inputRinexNavExample; + + std::string outputTestOutput; + std::string outputTestOutput2; + std::string outputTestOutput3; + std::string outputRinexDump; + + std::string inputInvalidLineLength; + std::string inputNotaNavFile; + std::string inputUnknownHeaderLabel; + std::string inputIncompleteHeader; + std::string inputUnsupportedRinex; + std::string inputBadHeader; + std::string outputTestOutputHeader; + + std::string inputFilterStream1; + std::string inputFilterStream2; + std::string inputFilterStream3; + std::string outputFilterOutput; + + std::string outputRinexStore; + + std::stringstream failDescriptionStream; + std::string failDescriptionString; + + std::string inputRinex3Nav; + std::string inputRinex2Nav; + std::string outputRinex3Nav; + std::string outputRinex2Nav; + + bool fileCompare; +}; + +//============================================================ +// Initialize Test Data Filenames +//============================================================ + +void Rinex3Nav_T :: init( void ) +{ + + TestUtil test0; + dataFilePath = test0.getDataPath(); + tempFilePath = test0.getTempPath(); + + //---------------------------------------- + // Full file paths + //---------------------------------------- + file_sep = getFileSep(); + + inputRinexNavExample = dataFilePath + file_sep + "test_input_rinex2_nav_RinexNavExample.99n"; + + outputTestOutput = tempFilePath + file_sep + "test_output_rinex2_nav_TestOutput.99n"; + outputTestOutput2 = tempFilePath + file_sep + "test_output_rinex2_nav_TestOutput2.99n"; + outputTestOutput3 = tempFilePath + file_sep + "test_output_rinex2_nav_TestOutput3.99n"; + outputRinexDump = tempFilePath + file_sep + "test_output_rinex2_nav_RinexDump.txt"; + + inputInvalidLineLength = dataFilePath + file_sep + "test_input_rinex2_nav_InvalidLineLength.99n"; + inputNotaNavFile = dataFilePath + file_sep + "test_input_rinex2_nav_NotaNavFile.99n"; + inputUnknownHeaderLabel = dataFilePath + file_sep + "test_input_rinex2_nav_UnknownHeaderLabel.99n"; + inputIncompleteHeader = dataFilePath + file_sep + "test_input_rinex2_nav_IncompleteHeader.99n"; + inputUnsupportedRinex = dataFilePath + file_sep + "test_input_rinex2_nav_UnsupportedRinex.99n"; + inputBadHeader = dataFilePath + file_sep + "test_input_rinex2_nav_BadHeader.99n"; + outputTestOutputHeader = tempFilePath + file_sep + "test_output_rinex2_nav_TestOutputHeader.99n"; + + inputFilterStream1 = dataFilePath + file_sep + "test_input_rinex2_nav_FilterTest1.99n"; + inputFilterStream2 = dataFilePath + file_sep + "test_input_rinex2_nav_FilterTest2.99n"; + inputFilterStream3 = dataFilePath + file_sep + "test_input_rinex2_nav_FilterTest3.99n"; + outputFilterOutput = tempFilePath + file_sep + "test_output_rinex2_nav_FilterOutput.txt"; + + outputRinexStore = tempFilePath + file_sep + "test_output_rinex2_nav_RinexStore.txt"; + +} + +//============================================================ +// Change input and output file names for Rinex v.3 types +//============================================================ + +void Rinex3Nav_T :: toRinex3(void) +{ + + std::cout<<"Running tests for Rinex version 3.0"<> Rinex3NavHeader; + out << Rinex3NavHeader; + + while( Rinex3NavStream >> Rinex3NavData ) + { + out << Rinex3NavData; + } + + if (Rinex3NavHeader.version == 2.1) + { + CompareVersion = 2.1; + CompareFileProgram = (std::string)"XXRINEXN V3"; + CompareFileAgency = (std::string)"AIUB"; + CompareDate = (std::string)"1999-09-02 19:22:36"; + CompareComment = (std::string)"THIS IS ONE COMMENT"; + } + + else if (Rinex3NavHeader.version == 3.02) + { + CompareVersion = 3.02; + CompareFileProgram = (std::string)"cnvtToRINEX 2.25.0"; + CompareFileAgency = (std::string)"convertToRINEX OPR"; + CompareDate = (std::string)"23-Jan-15 22:34 UTC"; + CompareComment = (std::string)"-----------------------------------------------------------"; + } + + test1.assert( Rinex3NavHeader.version == CompareVersion, "RinexNav Header version comparison", __LINE__ ); + test1.assert( Rinex3NavHeader.fileProgram == CompareFileProgram, "RinexNav Header file program comparison", __LINE__ ); + test1.assert( Rinex3NavHeader.fileAgency == CompareFileAgency, "RinexNav Header file agency comparison", __LINE__ ); + test1.assert( Rinex3NavHeader.date == CompareDate, "RinexNav Header date comparison", __LINE__ ); + + std::vector::const_iterator itr1 = Rinex3NavHeader.commentList.begin(); + test1.assert( (*itr1) == CompareComment, "RinexNav Header Comment comparison", __LINE__ ); + + + test1.assert( test1.fileEqualTest( inputRinexNavExample, outputTestOutput, 2 ), "RinexNav file read and then write, the two should be equal", __LINE__ ); + + //------------------------------------------------------------ + gpstk::Rinex3NavStream Rinex3NavStream2( outputTestOutput.c_str() ); + gpstk::Rinex3NavStream out2( outputTestOutput2.c_str(), std::ios::out ); + gpstk::Rinex3NavHeader Rinex3NavHeader2; + gpstk::Rinex3NavData Rinex3NavData2; + + Rinex3NavStream2 >> Rinex3NavHeader2; + out2 << Rinex3NavHeader2; + + while (Rinex3NavStream2 >> Rinex3NavData2) + { + out2 << Rinex3NavData2; + } + + gpstk::Rinex3NavStream Rinex3NavStream3( outputTestOutput2.c_str() ); + gpstk::Rinex3NavStream out3( outputTestOutput3.c_str() , std::ios::out ); + gpstk::Rinex3NavHeader Rinex3NavHeader3; + gpstk::Rinex3NavData Rinex3NavData3; + + Rinex3NavStream3 >> Rinex3NavHeader3; + out3 << Rinex3NavHeader3; + + while (Rinex3NavStream3 >> Rinex3NavData3) + { + out3 << Rinex3NavData3; + } + Rinex3NavHeader.dump( dmp ); + Rinex3NavData.dump( dmp ); + + test1.assert( test1.fileEqualTest( inputRinexNavExample, outputTestOutput3, 2 ), "test read TestOutput2", __LINE__ ); + } + catch(...) + { + test1.assert( false, "test read TestOutput2, unexpected exception", __LINE__ ); + } + + return( test1.countFails() ); +} + +//------------------------------------------------------------ +// This test check that Rinex Header exceptions are thrown +//------------------------------------------------------------ +int Rinex3Nav_T :: headerExceptionTest( void ) +{ + TestUtil test2( "Rinex3NavStream", "exceptions", __FILE__, __LINE__ ); + + std::string msg_test_desc = " "; + std::string msg_expected = ", should throw a gpstk::Exception"; + std::string msg_false_pass = ", but threw no exception."; + std::string msg_true_fail = ", but instead threw an unknown exception."; + + try + { + gpstk::Rinex3NavStream InvalidLineLength( inputInvalidLineLength.c_str() ); + gpstk::Rinex3NavStream NotaNavFile( inputNotaNavFile.c_str() ); + gpstk::Rinex3NavStream UnknownHeaderLabel( inputUnknownHeaderLabel.c_str() ); + gpstk::Rinex3NavStream IncompleteHeader( inputIncompleteHeader.c_str() ); + gpstk::Rinex3NavStream UnsupportedRinex( inputUnsupportedRinex.c_str() ); + gpstk::Rinex3NavStream BadHeader( inputBadHeader.c_str() ); + gpstk::Rinex3NavStream out( outputTestOutputHeader.c_str(), std::ios::out ); + gpstk::Rinex3NavHeader Header; + + InvalidLineLength.exceptions( std::fstream::failbit ); + NotaNavFile.exceptions( std::fstream::failbit ); + UnknownHeaderLabel.exceptions( std::fstream::failbit ); + IncompleteHeader.exceptions( std::fstream::failbit ); + UnsupportedRinex.exceptions( std::fstream::failbit ); + BadHeader.exceptions( std::fstream::failbit ); + + + //------------------------------------------------------------ + msg_test_desc = "InvalidLineLength test"; + try + { + InvalidLineLength >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } + + //------------------------------------------------------------ + msg_test_desc = "NotaNavFile test"; + try + { + NotaNavFile >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } + + //------------------------------------------------------------ + msg_test_desc = "UnknownHeaderLabel test"; + try + { + UnknownHeaderLabel >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } + + //------------------------------------------------------------ + msg_test_desc = "IncompleteHeader test"; + try + { + IncompleteHeader >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } + + //------------------------------------------------------------ + // msg_test_desc = "UnsupportedRinex test"; Rinex version 3.33 is marked supported +/* try + { + UnsupportedRinex >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } +*/ + //------------------------------------------------------------ + // msg_test_desc = "BadHeader test"; Rinex version 3.33 is marked supported, is header only bad b/c v. 3.33? +/* try + { + BadHeader >> Header; + test2.assert( false, msg_test_desc + msg_expected + msg_false_pass , __LINE__ ); + } + catch( gpstk::Exception e ) + { + test2.assert( true, msg_test_desc + msg_expected, __LINE__ ); + } + catch(...) + { + test2.assert( false, msg_test_desc + msg_expected + msg_true_fail, __LINE__ ); + } +*/ + //------------------------------------------------------------ + + } + catch(...) + { + test2.assert( false, "test failure message", __LINE__ ); + } + + return( test2.countFails() ); + +} + +//------------------------------------------------------------ +// Test Rinex3NavData File read/write with streams +// * Read Rinex Nav file directly into a RinexEphemerisStore +// * Write contents of RinexEphemerisStore back out to a new file +// * Diff the old file and the new file +//------------------------------------------------------------ +int Rinex3Nav_T :: streamReadWriteTest( void ) +{ + TestUtil test3( "Rinex3NavData", "Redirect", __FILE__, __LINE__ ); + + std::string msg_test_desc = "streamReadWriteTest test"; + std::string msg_expected = ", compares the output file with the input file"; + std::string msg_fail_equal = ", files are different!"; + std::string msg_fail_except = ", unexpectedly threw an exception."; + + try + { + Rinex3NavStream rinexInputStream( inputRinexNavExample.c_str() ); + Rinex3NavStream rinexOutputStream( outputRinexStore.c_str(), std::ios::out ); + Rinex3NavHeader streamTool; + rinexInputStream >> streamTool; // used to set rinexInputStream.header to a valid object + rinexOutputStream.header = rinexInputStream.header; + rinexOutputStream << rinexOutputStream.header; + + Rinex3NavData data; + while( rinexInputStream >> data ) + { + rinexOutputStream << data; + } + test3.assert( test3.fileEqualTest( inputRinexNavExample, outputRinexStore, 9), msg_test_desc + msg_expected + msg_fail_equal, __LINE__ ); + } + catch(...) + { + test3.assert( false, msg_test_desc + msg_expected + msg_fail_except, __LINE__ ); + } + + return( test3.countFails() ); + +} + +//------------------------------------------------------------ +// Test for several of the members within RinexNavFilterOperators +// including merge, EqualsFull, LessThanSimple, LessThanFull, and FilterPRN +//------------------------------------------------------------ +int Rinex3Nav_T :: filterOperatorsTest( void ) +{ + TestUtil test4( "Rinex3NavStream", "open", __FILE__, __LINE__ ); + + std::string msg_test_desc = ""; + std::string msg_expected = ", "; + std::string msg_fail = ", "; + + try + { + + gpstk::Rinex3NavStream FilterStream1( inputFilterStream1.c_str() ); + FilterStream1.open( inputFilterStream1.c_str(), std::ios::in ); + gpstk::Rinex3NavStream FilterStream2( inputFilterStream2.c_str() ); + gpstk::Rinex3NavStream FilterStream3( inputFilterStream3.c_str() ); + gpstk::Rinex3NavStream out( outputFilterOutput.c_str(), std::ios::out ); + + gpstk::Rinex3NavHeader FilterHeader1; + gpstk::Rinex3NavHeader FilterHeader2; + gpstk::Rinex3NavHeader FilterHeader3; + + gpstk::Rinex3NavData FilterData1; + gpstk::Rinex3NavData FilterData2; + gpstk::Rinex3NavData FilterData3; + + FilterStream1 >> FilterHeader1; + FilterStream2 >> FilterHeader2; + FilterStream3 >> FilterHeader3; + + while (FilterStream1 >> FilterData1) + { + } + while (FilterStream2 >> FilterData2) + { + } + while (FilterStream3 >> FilterData3) + { + } + + gpstk::Rinex3NavHeaderTouchHeaderMerge merged; + merged( FilterHeader1 ); + merged( FilterHeader2 ); + out << merged.theHeader; + + gpstk::Rinex3NavDataOperatorEqualsFull EqualsFull; + + msg_test_desc = "Rinex3NavDataOperatorEqualsFull, EqualsFUll FilterData1 FilterData2, fail"; + test4.assert( EqualsFull( FilterData1, FilterData2 ), msg_test_desc, __LINE__ ); + msg_test_desc = "Rinex3NavDataOperatorEqualsFull, FilterData1 not equal FilterData3, fail"; + test4.assert( !EqualsFull( FilterData1, FilterData3 ), msg_test_desc, __LINE__ ); + + gpstk::Rinex3NavDataOperatorLessThanSimple LessThanSimple; + + msg_test_desc = "Rinex3NavDataOperatorLessThanSimple, not LessThanSimple FilterData1 FilterData3, fail"; + test4.assert( !LessThanSimple(FilterData1, FilterData2), msg_test_desc, __LINE__ ); + //CPPUNIT_ASSERT_EQUAL(true,LessThanSimple(FilterData1, FilterData3)); + + gpstk::Rinex3NavDataOperatorLessThanFull LessThanFull; + + msg_test_desc = "Rinex3NavDataOperatorLessThanFull, not LessThanFull FilterData1 FilterData1, fail"; + //CPPUNIT_ASSERT_EQUAL(true,LessThanFull(FilterData1, FilterData3)); + //CPPUNIT_ASSERT_EQUAL(false,LessThanFull(FilterData3, FilterData1)); + test4.assert( !LessThanFull(FilterData1, FilterData1), msg_test_desc, __LINE__ ); + + std::list list; + list.push_front(6); + gpstk::Rinex3NavDataFilterPRN FilterPRN(list); + msg_test_desc = "Rinex3NavDataFilterPRN, FilterPRN FilterData3, fail"; + test4.assert( FilterPRN( FilterData3 ), msg_test_desc, __LINE__ ); + //cout << FilterPRN(FilterData3) << std:endl; + } + catch(...) + { + msg_test_desc = "filterOperatorsTest, threw unexpected exception, fail"; + test4.assert( false, msg_test_desc, __LINE__ ); + } + + return( test4.countFails() ); + +} + +//------------------------------------------------------------ +// Tests if a input Rinex 3 file can be output as a version 2 file +//------------------------------------------------------------ + +int Rinex3Nav_T :: version3ToVersion2Test(void) +{ + TestUtil testFramework("Rinex3Nav", "Convert v.3 to v.2", __FILE__, __LINE__ ); + + gpstk::Rinex3NavStream inputStream(inputRinex3Nav.c_str()); + gpstk::Rinex3NavStream outputStream(outputRinex2Nav.c_str(), std::ios::out); + gpstk::Rinex3NavHeader NavHeader; + gpstk::Rinex3NavData NavData; + + inputStream >> NavHeader; + + NavHeader.version = 2.11; + + outputStream << NavHeader; + while(inputStream >> NavData) + { + outputStream << NavData; + } + + //skip first 2 lines, not expected to match + fileCompare = testFramework.fileEqualTest(inputRinex2Nav, outputRinex2Nav, 2); + + failDescriptionString = "Version 2.11 output does not match expected file"; + testFramework.assert(fileCompare, failDescriptionString, __LINE__); + + return testFramework.countFails(); +} + +//------------------------------------------------------------ +// Tests if a input Rinex 2 file can be output as a version 3 file +//------------------------------------------------------------ + + +int Rinex3Nav_T :: version2ToVersion3Test(void) +{ + TestUtil testFramework("Rinex3Nav", "Convert v.2 to v.3", __FILE__, __LINE__ ); + + gpstk::Rinex3NavStream inputStream(inputRinex2Nav.c_str()); + gpstk::Rinex3NavStream outputStream(outputRinex3Nav.c_str(), std::ios::out); + gpstk::Rinex3NavHeader NavHeader; + gpstk::Rinex3NavData NavData; + + inputStream >> NavHeader; + + NavHeader.version = 3.02; + + outputStream << NavHeader; + while(inputStream >> NavData) + { + outputStream << NavData; + } + + //skip first 2 lines, not expected to match + fileCompare = testFramework.fileEqualTest(inputRinex3Nav, outputRinex3Nav, 2); + + failDescriptionString = "Version 3.02 output does not match expected file"; + testFramework.assert(fileCompare, failDescriptionString, __LINE__); + + return testFramework.countFails(); +} + + +//============================================================ +// Run all the test methods defined above +//============================================================ + +int main() +{ + + int errorCount = 0; + int errorTotal = 0; + Rinex3Nav_T testClass; + + std::cout << "Running tests for Rinex version 2.1" << std::endl; + + errorCount = testClass.headerExceptionTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.hardCodeTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.streamReadWriteTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.filterOperatorsTest(); + errorTotal = errorTotal + errorCount; + + //Change to test v.3 Rinex files + testClass.toRinex3(); + + errorCount = testClass.headerExceptionTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.hardCodeTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.streamReadWriteTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.filterOperatorsTest(); + errorTotal = errorTotal + errorCount; + + testClass.toConversionTest(); + + errorCount = testClass.version2ToVersion3Test(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.version3ToVersion2Test(); + errorTotal = errorTotal + errorCount; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal << std::endl; + + return( errorTotal ); +} diff --git a/core/tests/FileHandling/Rinex3Obs_T.cpp b/core/tests/FileHandling/Rinex3Obs_T.cpp new file mode 100644 index 000000000..4a19e872d --- /dev/null +++ b/core/tests/FileHandling/Rinex3Obs_T.cpp @@ -0,0 +1,671 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +// This software developed by Applied Research Laboratories at the University of +// Texas at Austin, under contract to an agency or agencies within the U.S. +// Department of Defense. The U.S. Government retains all rights to use, +// duplicate, distribute, disclose, or release this software. +// +// Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#include "Rinex3ObsBase.hpp" +#include "Rinex3ObsData.hpp" +#include "Rinex3ObsStream.hpp" +#include "Rinex3ObsHeader.hpp" +#include "Rinex3ObsFilterOperators.hpp" + +#include "build_config.h" + +#include "TestUtil.hpp" +#include +#include + +using namespace gpstk; + +//============================================================ +// Class decalarations +//============================================================ + +class Rinex3Obs_T +{ + public: + + // constructor + Rinex3Obs_T() + { + init(); + } + + void init( void ); + + void toRinex3( void ); + + // return values indicate number of failures, i.e., 0=PASS, !0=FAIL + int headerExceptionTest( void ); + int hardCodeTest( void ); + int filterOperatorsTest( void ); + int dataExceptionsTest( void ); + + void toConversionTest( void ); + int version2ToVersion3Test( void ); + int version3ToVersion2Test( void ); + + private: + + std::string dataFilePath; + std::string tempFilePath; + std::string file_sep; + + std::string dataRinexObsFile; + std::string dataIncompleteHeader; + std::string dataInvalidLineLength; + std::string dataInvalidNumPRNWaveFact; + std::string dataNotObs; + std::string dataSystemGeosync; + std::string dataSystemGlonass; + std::string dataSystemMixed; + std::string dataSystemTransit; + std::string dataUnSupVersion ; + std::string dataRinexContData; + + std::string dataBadEpochLine; + std::string dataBadEpochFlag; + std::string dataBadLineSize; + std::string dataInvalidTimeFormat; + + std::string dataFilterTest1; + std::string dataFilterTest2; + std::string dataFilterTest3; + std::string dataFilterTest4; + + std::string dataTestOutput; + std::string dataTestOutput2; + std::string dataTestOutput3; + std::string dataTestOutputObsDump; + std::string dataTestOutputDataException; + std::string dataTestFilterOutput; + + std::string dataInputRinex3ObsFile; + std::string dataInputRinex2ObsFile; + std::string dataOutputRinex3ObsFile; + std::string dataOutputRinex2ObsFile; + + std::string testMesg; +}; + +//============================================================ +// Initialize Test Data Filenames +//============================================================ + +void Rinex3Obs_T :: init( void ) +{ + + std::cout<<"Running tests for Rinex version 2.0"<> Rinex3ObsFileh; + ih >> ihh; + il >> ilh; + inpwf >> inpwfh; + no >> noh; + ss >> ssh; + sr >> srh; + sm >> smh; + unsupv >> unsupvh; + contdata >> contdatah; // not in v3 test + + out << Rinex3ObsFileh; + out << ihh; + out << ilh; + out << inpwfh; + out << noh; + out << ssh; + out << srh; + out << smh; + out << unsupvh; + out2 << contdatah; // not in v3 test + Rinex3ObsFile >> Rinex3ObsFiled; + Rinex3ObsFiled.dump( dump ); + + while( Rinex3ObsFile >> Rinex3ObsFiled ) + { + out << Rinex3ObsFiled; // Outputting v.3 data instead of v.2 + } + + while( contdata >> contdatad ) // not in v3 test + { + out2 << contdatad; + } + + + Rinex3ObsFileh.dump( dump ); + contdatah.dump( dump ); // not in v3 test + ilh.dump( dump ); + // gpstk::DisplayExtendedRinexObsTypes( dump ); + // testID.dump( dump ); + + // std::cout< 3 ) HeaderRecordNumber = 30; + + test1.assert( HeaderRecordNumber == Rinex3ObsFileh.NumberHeaderRecordsToBeWritten(), msg_test_desc + msg_false_pass, __LINE__ ); + } + catch(gpstk::Exception e) + { + test1.assert( false, msg_test_desc + msg_fail + e.what(), __LINE__ ); + } + catch(...) + { + test1.assert( false, msg_test_desc + msg_fail, __LINE__ ); + } + + return( test1.countFails() ); +} + + +//------------------------------------------------------------ +// This test checks to make sure that the output +// from a read in Rinex3ObsFile matches the input. +//------------------------------------------------------------ +int Rinex3Obs_T :: hardCodeTest( void ) +{ + + bool files_equal = false; + double CompareVersion; + std::string CompareFileProgram; + std::string CompareFileAgency; + std::string CompareDate; + + // Previous comments indicated that these Rinex methods + // are not expected to match in the top two lines of the file + int num_lines_skip = 2; + + TestUtil test2( "Rinex3ObsStream", "dump", __FILE__, __LINE__ ); + + std::string msg_test_desc = "Rinex3ObsStream, read write test, comparing input file and output file"; + std::string msg_fail_equal = ", input and output do not match."; + std::string msg_fail_except = ", threw an unexpected exception."; + + try + { + gpstk::Rinex3ObsStream Rinex3ObsFile( dataRinexObsFile ); + gpstk::Rinex3ObsStream out( dataTestOutput2, std::ios::out ); + gpstk::Rinex3ObsStream dump( dataTestOutputObsDump, std::ios::out ); + gpstk::Rinex3ObsHeader Rinex3ObsFileh; + gpstk::Rinex3ObsData Rinex3ObsFiled; + + Rinex3ObsFile >> Rinex3ObsFileh; + out << Rinex3ObsFileh; + + while( Rinex3ObsFile >> Rinex3ObsFiled ) + { + out << Rinex3ObsFiled; + // std::cout<> BadEpochLined ) + { + out << BadEpochLined; + } + while( BadEpochFlag >> BadEpochFlagd ) + { + out << BadEpochFlagd; + } + while( BadLineSize >> BadLineSized ) + { + out << BadLineSized; + } + while( InvalidTimeFormat >> InvalidTimeFormatd ) + { + out << InvalidTimeFormatd; + } + test3.assert( true, msg_test_desc + msg_fail_throw, __LINE__ ); + } + catch(...) + { + test3.assert( false, msg_test_desc + msg_fail_except, __LINE__ ); + } + + return( test3.countFails() ); + +} + +//------------------------------------------------------------ +// This is the test for several of the members within Rinex3ObsFilterOperators +// including merge, LessThanSimple, EqualsSimple, and LessThanFull. +//------------------------------------------------------------ +int Rinex3Obs_T :: filterOperatorsTest( void ) +{ + + TestUtil test4( "Rinex3ObsStream", "open", __FILE__, __LINE__ ); + + std::string msg_test_desc = ""; + + try + { + gpstk::Rinex3ObsStream FilterStream1( dataFilterTest1 ); + FilterStream1.open( dataFilterTest1, std::ios::in ); + + gpstk::Rinex3ObsStream FilterStream2( dataFilterTest2 ); + gpstk::Rinex3ObsStream FilterStream3( dataFilterTest3 ); + gpstk::Rinex3ObsStream FilterStream4( dataFilterTest4 ); + gpstk::Rinex3ObsStream out( dataTestFilterOutput, std::ios::out ); + + gpstk::Rinex3ObsHeader FilterHeader1; + gpstk::Rinex3ObsHeader FilterHeader2; + gpstk::Rinex3ObsHeader FilterHeader3; + gpstk::Rinex3ObsHeader FilterHeader4; + + gpstk::Rinex3ObsData FilterData1; + gpstk::Rinex3ObsData FilterData2; + gpstk::Rinex3ObsData FilterData3; + gpstk::Rinex3ObsData FilterData4; + + + FilterStream1 >> FilterHeader1; + FilterStream2 >> FilterHeader2; + FilterStream3 >> FilterHeader3; + FilterStream4 >> FilterHeader4; + + while( FilterStream1 >> FilterData1) + { + } + while( FilterStream2 >> FilterData2) + { + } + while( FilterStream3 >> FilterData3) + { + } + while( FilterStream4 >> FilterData4) + { + } + + gpstk::Rinex3ObsHeaderTouchHeaderMerge merged; + merged( FilterHeader1 ); + merged( FilterHeader2 ); + + gpstk::Rinex3ObsDataOperatorLessThanFull( merged.obsSet ); + out << merged.theHeader; + + gpstk::Rinex3ObsDataOperatorEqualsSimple EqualsSimple; + msg_test_desc = "Rinex3ObsDataOperatorEqualsSimple( FilterData1, FilterData1 ), should evaluate as true"; + test4.assert( EqualsSimple( FilterData1, FilterData1 ), msg_test_desc, __LINE__ ); + + gpstk::Rinex3ObsDataOperatorLessThanSimple LessThanSimple; + msg_test_desc = "Rinex3ObsDataOperatorLessThanSimple( FilterData1, FilterData1 ) should evaluated as false"; + test4.assert( !LessThanSimple( FilterData1, FilterData1 ), msg_test_desc, __LINE__ ); + + gpstk::Rinex3ObsDataOperatorLessThanFull LessThanFull( merged.obsSet ); + msg_test_desc = "Rinex3ObsDataOperator LessThanFull( FilterData1, FilterData1 ) should evaluate as false "; + test4.assert( !LessThanFull( FilterData1, FilterData1 ) , msg_test_desc, __LINE__ ); + + msg_test_desc = " Rinex3ObsDataOperator LessThanFull( FilterData1, FilterData2 ) should evaluate as false "; + test4.assert( !LessThanFull( FilterData1, FilterData2 ) , msg_test_desc, __LINE__ ); + + } + catch(...) + { + msg_test_desc = "One or more of the tests for Rinex3ObsDataOperator LessThanFull threw an exception when it should not have"; + test4.assert( false, msg_test_desc, __LINE__ ); + } + + return( test4.countFails() ); + +} + +//------------------------------------------------------------ +// Tests if a input Rinex 3 file can be output as a version 2 file +//------------------------------------------------------------ + +int Rinex3Obs_T :: version3ToVersion2Test( void ) +{ + TestUtil testFramework("Rinex3Obs", "Convert v.3 to v.2", __FILE__, __LINE__ ); + + gpstk::Rinex3ObsStream inputStream(dataInputRinex3ObsFile.c_str()); + gpstk::Rinex3ObsStream outputStream(dataOutputRinex2ObsFile.c_str(), std::ios::out); + gpstk::Rinex3ObsHeader ObsHeader; + gpstk::Rinex3ObsData ObsData; + + inputStream >> ObsHeader; + + ObsHeader.PrepareVer2Write(); + + outputStream << ObsHeader; + while(inputStream >> ObsData) + { + outputStream << ObsData; + } + + testMesg = "No automatic comparison implemented. If " + + dataOutputRinex2ObsFile + " is not the proper conversion of " + + dataInputRinex3ObsFile + "test has failed. Currently PrepareVer2Write() " + + "function is BROKEN!"; + + testFramework.assert(false, testMesg, __LINE__); + + return testFramework.countFails(); +} + +//------------------------------------------------------------ +// Tests if a input Rinex 2 file can be output as a version 3 file +//------------------------------------------------------------ + +int Rinex3Obs_T :: version2ToVersion3Test( void ) +{ + TestUtil testFramework("Rinex3Obs", "Convert v.2 to v.3", __FILE__, __LINE__ ); + + gpstk::Rinex3ObsStream inputStream(dataInputRinex2ObsFile.c_str()); + gpstk::Rinex3ObsStream outputStream(dataOutputRinex3ObsFile.c_str(), std::ios::out); + gpstk::Rinex3ObsHeader ObsHeader; + gpstk::Rinex3ObsData ObsData; + + inputStream >> ObsHeader; + + ObsHeader.version = 3.02; //No PrepareVersion3Write function, only way to change version number + + outputStream << ObsHeader; + while(inputStream >> ObsData) + { + outputStream << ObsData; + } + + testMesg = "No automatic comparison implemented. If " + + dataOutputRinex2ObsFile + " is not the proper conversion of " + + dataInputRinex3ObsFile + "test has failed. Currently only conversion " + + "from v.2.11 to v.3.02 is to change version number by hand. This " + + "doesn't produce a valid header, so this functionality is MISSING!"; + + testFramework.assert(false, testMesg, __LINE__); + + return testFramework.countFails(); +} + +//============================================================ +// Run all the test methods defined above +//============================================================ + +int main() +{ + int errorCount = 0; + int errorTotal = 0; + Rinex3Obs_T testClass; + + errorCount = testClass.headerExceptionTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.hardCodeTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.dataExceptionsTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.filterOperatorsTest(); + errorTotal = errorTotal + errorCount; + + //Change to test v.3 + testClass.toRinex3(); + + errorCount = testClass.headerExceptionTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.hardCodeTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.dataExceptionsTest(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.filterOperatorsTest(); + errorTotal = errorTotal + errorCount; + + testClass.toConversionTest(); + + errorCount = testClass.version3ToVersion2Test(); + errorTotal = errorTotal + errorCount; + + errorCount = testClass.version2ToVersion3Test(); + errorTotal = errorTotal + errorCount; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal << std::endl; + + return( errorTotal ); +} diff --git a/core/tests/FileHandling/RinexMet_T.cpp b/core/tests/FileHandling/RinexMet_T.cpp index b14c8deb6..f70bc483b 100644 --- a/core/tests/FileHandling/RinexMet_T.cpp +++ b/core/tests/FileHandling/RinexMet_T.cpp @@ -43,6 +43,8 @@ #include "StringUtils.hpp" #include "Exception.hpp" +#include "build_config.h" + #include "TestUtil.hpp" #include #include @@ -164,7 +166,7 @@ void RinexMet_T :: init( void ) //---------------------------------------- // Full file paths //---------------------------------------- - std::string file_sep = "/"; + std::string file_sep = gpstk::getFileSep(); inputRinexMetNormal = dataFilePath + file_sep + "test_input_rinex_met_408_110a.04m" ; // Formerly without the "test_input_rinex_met_" prefix string inputRinexMetBLL = dataFilePath + file_sep + "test_input_rinex_met_BLL.04m" ; diff --git a/core/tests/FileHandling/RinexNav_T.cpp b/core/tests/FileHandling/RinexNav_T.cpp index 3a40ef523..e58081175 100644 --- a/core/tests/FileHandling/RinexNav_T.cpp +++ b/core/tests/FileHandling/RinexNav_T.cpp @@ -45,6 +45,8 @@ #include "Exception.hpp" #include "RinexEphemerisStore.hpp" +#include "build_config.h" + #include "TestUtil.hpp" #include #include @@ -121,7 +123,7 @@ void RinexNav_T :: init( void ) //---------------------------------------- // Full file paths //---------------------------------------- - std::string file_sep = "/"; + std::string file_sep = getFileSep(); inputRinexNavExample = dataFilePath + file_sep + "test_input_rinex_nav_RinexNavExample.99n"; diff --git a/core/tests/FileHandling/RinexObs_T.cpp b/core/tests/FileHandling/RinexObs_T.cpp index c72a02076..80e6a24ed 100644 --- a/core/tests/FileHandling/RinexObs_T.cpp +++ b/core/tests/FileHandling/RinexObs_T.cpp @@ -40,6 +40,8 @@ #include "RinexObsHeader.hpp" #include "RinexObsFilterOperators.hpp" +#include "build_config.h" + #include "TestUtil.hpp" #include #include @@ -115,7 +117,7 @@ void RinexObs_T :: init( void ) //---------------------------------------- // Full file paths //---------------------------------------- - std::string file_sep = "/"; + std::string file_sep = getFileSep(); dataRinexObsFile = dataFilePath + file_sep + "test_input_rinex_obs_RinexObsFile.06o"; dataIncompleteHeader = dataFilePath + file_sep + "test_input_rinex_obs_IncompleteHeader.06o"; diff --git a/core/tests/GNSSCore/CMakeLists.txt b/core/tests/GNSSCore/CMakeLists.txt index 8ff961032..6c20abf34 100644 --- a/core/tests/GNSSCore/CMakeLists.txt +++ b/core/tests/GNSSCore/CMakeLists.txt @@ -35,3 +35,7 @@ add_test(GNSSCore_WxObsMap WxObsMap_T) add_executable(Xvt_T Xvt_T.cpp) target_link_libraries(Xvt_T gpstk) add_test(GNSSCore_Xvt Xvt_T) + +add_executable(SVNumXRef_T SVNumXRef_T.cpp) +target_link_libraries(SVNumXRef_T gpstk) +add_test(GNSSCore_SVNumXRef SVNumXRef_T) diff --git a/core/tests/GNSSCore/Convhelp_T.cpp b/core/tests/GNSSCore/Convhelp_T.cpp index aa905a142..1910ecb82 100644 --- a/core/tests/GNSSCore/Convhelp_T.cpp +++ b/core/tests/GNSSCore/Convhelp_T.cpp @@ -38,6 +38,7 @@ #include "TestUtil.hpp" #include +#include class Convhelp_T { @@ -54,14 +55,14 @@ class Convhelp_T gpstk::GPSEllipsoid gem; failMesg = "Did the computation work with positive values?"; - testFramework.assert(abs(gpstk::cycles2meters(100000.,400000.,wem) - 74948114.5) < eps, failMesg, __LINE__); - testFramework.assert(abs(gpstk::cycles2meters(10000,40000,gem) - 1.3342563807926082) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::cycles2meters(100000.,400000.,wem) - 74948114.5) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::cycles2meters(10000,40000,gem) - 1.3342563807926082) < eps, failMesg, __LINE__); failMesg = "Did the computation work with a 0 value?"; testFramework.assert(gpstk::cycles2meters(0,5,wem) == 0, failMesg, __LINE__); testFramework.assert(gpstk::cycles2meters(0,5,gem) == 0, failMesg, __LINE__); failMesg = "Did the computation work with a negative value?"; - testFramework.assert(abs(gpstk::cycles2meters(-100000.,400000.,wem) + 74948114.5) < eps, failMesg, __LINE__); - testFramework.assert(abs(gpstk::cycles2meters(-10000,40000,gem) + 1.3342563807926082) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::cycles2meters(-100000.,400000.,wem) + 74948114.5) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::cycles2meters(-10000,40000,gem) + 1.3342563807926082) < eps, failMesg, __LINE__); return testFramework.countFails(); } @@ -75,17 +76,17 @@ class Convhelp_T gpstk::GPSEllipsoid gem; failMesg = "Did the computation work with positive values?"; - testFramework.assert(abs(gpstk::meters2cycles(74948114.5,400000.,wem) - 100000) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::meters2cycles(74948114.5,400000.,wem) - 100000) < eps, failMesg, __LINE__); failMesg = "Did the above computation work with the GPS ellipsoid?"; - testFramework.assert(abs(gpstk::meters2cycles(10000,40000,gem) - 1.3342563807926082 ) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::meters2cycles(10000,40000,gem) - 1.3342563807926082 ) < eps, failMesg, __LINE__); failMesg = "Did the computation work with a 0 value?"; testFramework.assert(gpstk::meters2cycles(0,5,wem) == 0, failMesg, __LINE__); failMesg = "Did the above computation work with the GPS ellipsoid?"; testFramework.assert(gpstk::meters2cycles(0,5,gem) == 0, failMesg, __LINE__); failMesg = "Did the computation work with a negative value?"; - testFramework.assert(abs(gpstk::meters2cycles(-74948114.5,400000.,wem) + 100000) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::meters2cycles(-74948114.5,400000.,wem) + 100000) < eps, failMesg, __LINE__); failMesg = "Did the above computation work with the GPS ellipsoid?"; - testFramework.assert(abs(gpstk::meters2cycles(-74948114.5,400000.,wem) + 100000) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::meters2cycles(-74948114.5,400000.,wem) + 100000) < eps, failMesg, __LINE__); return testFramework.countFails(); } @@ -126,11 +127,11 @@ class Convhelp_T std::string failMesg; failMesg = "Did the computation work with a postitive value?"; - testFramework.assert(abs(gpstk::mb2hg(100) - 2.9529987508079487) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::mb2hg(100) - 2.9529987508079487) < eps, failMesg, __LINE__); failMesg = "Did the computation work with a 0 value?"; testFramework.assert(gpstk::mb2hg(0) == 0, failMesg, __LINE__); failMesg = "Did the computation work with a negative value?"; - testFramework.assert(abs(gpstk::mb2hg(-100) + 2.9529987508079487) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::mb2hg(-100) + 2.9529987508079487) < eps, failMesg, __LINE__); return testFramework.countFails(); } @@ -141,11 +142,11 @@ class Convhelp_T std::string failMesg; failMesg = "Did the computation work with a postitive value?"; - testFramework.assert(abs(gpstk::hg2mb(2.9529987508079487) - 100) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::hg2mb(2.9529987508079487) - 100) < eps, failMesg, __LINE__); failMesg = "Did the computation work with a 0 value?"; testFramework.assert(gpstk::hg2mb(0) == 0, failMesg, __LINE__); failMesg = "Did the computation work with a negative value?"; - testFramework.assert(abs(gpstk::hg2mb(-2.9529987508079487) + 100) < eps, failMesg, __LINE__); + testFramework.assert(std::abs(gpstk::hg2mb(-2.9529987508079487) + 100) < eps, failMesg, __LINE__); return testFramework.countFails(); } diff --git a/core/tests/GNSSCore/SVNumXRef_T.cpp b/core/tests/GNSSCore/SVNumXRef_T.cpp new file mode 100644 index 000000000..4295a00d9 --- /dev/null +++ b/core/tests/GNSSCore/SVNumXRef_T.cpp @@ -0,0 +1,26 @@ +/********************************************************************* +* +* Test program for gpstk/core/lib/GNSSCore/SVNumXRef. +* The last line of output will be "1" if the test passes, +* and "0" if it fails. +* isConsistent() returns 1 if there are no overlaps in +* PRN-SVN relationships and 0 otherwise. +* +*********************************************************************/ +#include +#include "SVNumXRef.hpp" + +using namespace std; +using namespace gpstk; + +int main( int argc, char * argv[] ) +{ + cout << "Entering SVNumXRef_T" << endl; + int testVal; + SVNumXRef svNumXRef; + testVal = svNumXRef.isConsistent(); + if (testVal == 1) + testVal = 0; + + return(testVal); +} diff --git a/core/tests/GNSSCore/WxObsMap_T.cpp b/core/tests/GNSSCore/WxObsMap_T.cpp index 32c2ea46c..42cdd2ef2 100755 --- a/core/tests/GNSSCore/WxObsMap_T.cpp +++ b/core/tests/GNSSCore/WxObsMap_T.cpp @@ -40,6 +40,7 @@ #include #include #include +#include class WxObsMap_T { diff --git a/core/tests/GNSSEph/AlmanacDataGenerator.hpp b/core/tests/GNSSEph/AlmanacDataGenerator.hpp new file mode 100755 index 000000000..8087b1251 --- /dev/null +++ b/core/tests/GNSSEph/AlmanacDataGenerator.hpp @@ -0,0 +1,232 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#include +#include +#include +#include +#include +#include +#include + +//Reads in the almanac file and stores it in data types +class AlmanacData +{ + public: + int id[31]; + int health[31]; + float ecc[31]; + float toa[31]; + float oi[31]; + float rora[31]; + float sqrta[31]; + float raaw[31]; + float aop[31]; + float ma[31]; + float af0[31]; + float af1[31]; + float week[31]; + std::string line; + + AlmanacData(void) + { + + } + + AlmanacData(std::ifstream &file) + { + for (int i=0; i<31; i++) + { + getline(file, line); //skip + id[i] = readData(file); // sat id + health[i] = readData(file); + ecc[i] = readData(file); // eccentricity (e) + toa[i] = readData(file); // Time of Applicability (toa) + oi[i] = readData(file); // Orbital Inclination (detai) + rora[i] = readData(file); // Rate of Right Ascension (OMEGADOT) + sqrta[i] = readData(file); + raaw[i] = readData(file); // Rate of Ascension at Week (OMEGA0) + aop[i] = readData(file); // Argument of Perigee (omega) + ma[i] = readData(file); // Mean Anomaly (M0) + af0[i] = readData(file); + af1[i] = readData(file); + week[i] = readData(file); + getline(file, line); //skip + } + + } + + float readData(std::ifstream &file) + { + getline(file, line); + line=cleanLine(line); + return atof(line.c_str()); + } + + std::string cleanLine(std::string line) + { + line = line.substr(25, std::string::npos); + line.erase( std::remove(line.begin(), line.end(), ' '), line.end()); + return line; + } +}; + +//Converts almanac data to subframes +//No parity! EngAlmanac doesn't test for parity +class AlmanacSubframes +{ +public: + struct SVsubframes + { + uint32_t word1; + uint32_t word2; + uint32_t word3; + uint32_t word4; + uint32_t word5; + uint32_t word6; + uint32_t word7; + uint32_t word8; + uint32_t word9; + uint32_t word10; + } allSVs[31]; + + long totalSf[31][10]; + + AlmanacSubframes(void) + { + + } + + AlmanacSubframes(AlmanacData aData) //Shouldn't be a reference, need the original data for comparison + { + scaleData(aData); + + for (int i=0; i<31; i++) + { + allSVs[i].word1 = 0x22c000e4; + allSVs[i].word2 = 0x00000598; + if(aData.id[i] > 25) allSVs[i].word2 = 0x0000042c; + allSVs[i].word3 = ( (( (1 << 6) + ((uint32_t) aData.id[i])) << 16) + ((uint32_t) aData.ecc[i]) ) << 6; + allSVs[i].word4 = ( (((uint32_t) aData.toa[i]) << 16) + ((uint32_t) aData.oi[i]) ) << 6; + allSVs[i].word5 = ( (((uint32_t) aData.rora[i]) << 8) + ((uint32_t) aData.health[i]) ) << 6; + allSVs[i].word6 = ((uint32_t) aData.sqrta[i]) << 6; + allSVs[i].word7 = ((uint32_t) aData.raaw[i]) << 6; + allSVs[i].word8 = ((uint32_t) aData.aop[i]) << 6; + allSVs[i].word9 = ((uint32_t) aData.ma[i]) << 6; + startaf0 = ( (uint32_t) aData.af0[i] ) >> 3; + endaf0 = (((uint32_t) aData.af0[i]) << (32-3)) >> (32-3); + allSVs[i].word10 = ( (((startaf0 << 11) + (uint32_t) aData.af1[i]) << 3) + endaf0 ) << 8; + + totalSf[i][0] = allSVs[i].word1; + totalSf[i][1] = allSVs[i].word2; + totalSf[i][2] = allSVs[i].word3; + totalSf[i][3] = allSVs[i].word4; + totalSf[i][4] = allSVs[i].word5; + totalSf[i][5] = allSVs[i].word6; + totalSf[i][6] = allSVs[i].word7; + totalSf[i][7] = allSVs[i].word8; + totalSf[i][8] = allSVs[i].word9; + totalSf[i][9] = allSVs[i].word10; + } + + } + + AlmanacData scaleData(AlmanacData &aData) + { + for(int i=0; i<31; i++) + { + //pow is used to scale, round returns an signed int, uint32_t recasts to unsigned + //resigned in 32, so + aData.ecc[i] = twosCompliment((uint32_t) round(aData.ecc[i] * pow(2.,21)), 16); + aData.toa[i] = twosCompliment((uint32_t) round(aData.toa[i] * pow(2.,-12)), 8); + aData.oi[i] = twosCompliment((uint32_t) round((aData.oi[i] - .3*M_PI) * pow(2., 19) / M_PI), 16); + aData.rora[i] = twosCompliment((uint32_t) round(aData.rora[i] * pow(2.,38) / M_PI), 16); + aData.sqrta[i] = twosCompliment((uint32_t) round(aData.sqrta[i] * pow(2.,11)), 24); + aData.raaw[i] = twosCompliment((uint32_t) round(aData.raaw[i] * pow(2.,23) / M_PI), 24); + aData.aop[i] = twosCompliment((uint32_t) round(aData.aop[i] * pow(2.,23) / M_PI), 24); + aData.ma[i] = twosCompliment((uint32_t) round(aData.ma[i] * pow(2.,23) / M_PI), 24); + aData.af0[i] = twosCompliment(((uint32_t) round(aData.af0[i] * pow(2.,20))), 11); + aData.af1[i] = twosCompliment(((uint32_t) round(aData.af1[i] * pow(2.,38))), 11); + } + + return aData; + } + + uint32_t twosCompliment(uint32_t data, int size) + { + if (data > 0x1000) + data = (data << (32 - size)) >> (32-size); + else data = (uint32_t) round(data); + + return data; + } + + uint32_t startaf0; + uint32_t endaf0; +}; + + uint32_t threesCompliment(uint32_t data, int size) + { + if (data > 0x1000) + data = (data << (32 - size)) >> (32-size); + else data = (uint32_t) round(data); + + return data; + } +/* +int main(void) +{ + std::ifstream file("./current.txt"); + + AlmanacData aData(file); + AlmanacSubframes dataIHope(aData); + + for (int i = 0; i<31; i++) + { + std::cout< +#include "AlmanacDataGenerator.hpp" +#include "BinUtils.hpp" + class EngAlmanac_T { - public: - EngAlmanac_T(){}// Default Constructor, set the precision value - ~EngAlmanac_T() {} // Default Desructor + public: + //Reads in AlmanacData object to form comparison data types + EngAlmanac_T(AlmanacData iAData, AlmanacSubframes iASubframes) + { + eps = 1E-6; //Low precision, data is extracted from binary subframes, some have only 16 bit precision + aData = iAData; + aSubframes = iASubframes; + + } + + ~EngAlmanac_T() {} // Default Desructor + + gpstk::EngAlmanac dataStore; + + int addSubframeTest(void) + { + TestUtil testFramework("EngAlmanac", "addSubframe", __FILE__, __LINE__); + + + //Subframe and week number mod 1024 + testMesg = "Adding subframe 5 page 1 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[0], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 2 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[1], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 3 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[2], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 4 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[3], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 5 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[4], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 6 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[5], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 7 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[6], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 8 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[7], 819), testMesg, __LINE__); + //skip this test, no valid almanac data for PRN 8 + // testMesg = "Adding subframe 5 page 9 failed"; + // testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[31], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 10 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[8], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 11 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[9], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 12 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[10], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 13 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[11], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 14 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[12], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 15 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[13], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 16 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[14], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 17 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[15], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 18 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[16], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 19 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[17], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 20 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[18], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 21 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[19], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 22 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[20], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 23 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[21], 819), testMesg, __LINE__); + testMesg = "Adding subframe 5 page 24 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[22], 819), testMesg, __LINE__); + + testMesg = "Adding subframe 4 page 2 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[23], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 3 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[24], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 4 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[25], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 5 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[26], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 7 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[27], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 8 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[28], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 9 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[29], 819), testMesg, __LINE__); + testMesg = "Adding subframe 4 page 10 failed"; + testFramework.assert(dataStore.addSubframe(aSubframes.totalSf[30], 819), testMesg, __LINE__); + +//subframe 5 page 25 +/* + copy the tlm and how from above for subframe 5 + dataID = 2 (from the IS-GPS-200) + svID = 51 for this page + toa = 319488 * 2**-12 + WNa = 819 % 256 = 51 + all sv healths are good except 8, set it to 111111 (or leave it blank, don't think it matters) + + word 3: + dID svID (51) 319488*2**-12 = 78 Wn = 51 + 10 110011 01001110 00110011 = 10 1100 1101 0011 1000 1100 1100 0000 + 2CD38CC0 + + word 5: + 00 0000 0000 00 00 0000 1111 11 00 0000 + + word 10 is reserved, doesn't matter what set to + +*/ + const long subframe551[10] = {0x22c000e4, 0x00000598, 0x2CD38CC0, 0x00000000, 0x00000FC0, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x11111110}; + testMesg = "Adding subframe 5 page 25 failed"; + testFramework.assert(dataStore.addSubframe(subframe551, 819), testMesg, __LINE__); + +//subframe 4 page 25 +/* + copy the tlm and the how from above for subframe 4 + dataID = 2 (from the IS-GPS-200) + svID = 63 for this page + + Assume reserved bits are 1, and all satellites have Anti spoofing on and are in block II//IIA/IIR + therefore all the sv configs need to be set to 1001 + + word 3 + dID svID 4 svconfigs + 10 1111 11 10 0110 0110 0110 01 = 0x2F666640 + + word 4,5,6,7 + 6 sv configs + 10 0110 0110 0110 0110 0110 01 = 0x26666640 + + word 8 + 4 sv configs 2 reserved 1 sv health + 10 0110 0110 0110 01 11 0000 00 = 0x26667000 + + word 9 + 5 sv healths, all 0 = 0x00000000 + + word 10 + 3 sv healths 4 reserved 2 parity + 00 0000 0000 0000 0000 1111 00 = 0x00000F00 + +*/ + const long subframe447[10] = {0x22c000e4, 0x0000042c, 0x2FE66640, 0x26666640, 0x26666640, + 0x26666640, 0x26666640, 0x26667000, 0x00000000, 0x00000F00}; + testMesg = "Adding subframe 4 page 25 failed"; + testFramework.assert(dataStore.addSubframe(subframe447, 819), testMesg, __LINE__); + +// subframe4 page 18 +/* + copy tlm and how from other subframe4 pages + data id = 2 + sv id = 56 + + //deadbeefdeadc0de + alpha0 = (222 - 256) * 2**-30 = -3.166496753692627e-08 //Twos compliment + alpha1 = (173 - 256) * 2**-27 / pi = -1.968422573302286e-07 + alpha2 = (190 - 256) * 2**-24 / pi**2 = -3.985880685087617e-07 + alpha3 = (239 - 256) * 2**-24 / pi**3 = -3.26798013069863e-08 + beta0 = (222 - 256) * 2**11 = -69632 //Twos compliment + beta1 = (173 - 256) * 2**14 / pi = -432860.7015445238 + beta2 = (192 - 256) * 2**16 / pi**2 = -424971.8458357919 + beta3 = (222 - 256) * 2**16 / pi**3 = -71863.64306088151 + + //cabobobs + A0 = (3400577205 - 4294967296) * 2**-30 = -0.8329656822606921 + //baddab + A1 = (12246443 - 16777216) * 2**-50 = -4.0241348031599955e-09 + dtLS = 13 = 0x0d + tot = 110 * 2**12 = 450560 = 0x6e + WNt = 90 = 0x5a + WNLSF = 254 = 0xFE + DN (right justified) = 5 =>0x05 + dtLSF = (153 - 256) = -103 = 0x99 + + + word 3 + dataID svID alpha0 alpha1 parity + 10 111000 11011110 10101101 000000 = 0x2e37ab40 + + word 4 + alpha2 alpha3 beta0 parity + 10111110 11101111 11011110 000000 = 0x2fbbf780 + + word 5 + beta1 beta2 beta3 parity + 10101101 11000000 11011110 000000 = 0x2b703780 + + word 6 + A0 parity + 11001010101100001011000010110101 000000 = 0x2eb76ac0 + + word 7 + A1 (24 msb) parity + 110010101011000010110000(10110101) 000000 = 0x32ac2c00 + + word 8 + A0 (8 lsb) tot WNt parity + 10110101 01101110 01011010 000000 = 0x2d5b9680 + + word 9 + dtLS WNLSF DN parity + 00001101 11111110 00000101 000000 = 0x037f8140 + + word 10 + dtLSF 14b reserved 2b parity + 10011001 11111111111111 00 000000 = 0x267fff00 +*/ + const long subframe456[10] = {0x22c000e4, 0x0000042c, 0x2e37ab40, 0x2fbbf780, 0x2b703780, + 0x2eb76ac0, 0x32ac2c00, 0x2d5b9680, 0x037f8140, 0x267fff00}; + testMesg = "Adding subframe 4 page 18 failed"; + testFramework.assert(dataStore.addSubframe(subframe456, 819), testMesg, __LINE__); + + + return testFramework.countFails(); + } + + int getTest(void) + { + int x, failCount; + TestUtil testFramework("EngAlmanac", "getTest", __FILE__, __LINE__); + + //GPSTK documentation should really say what units these return as + // For loop which tests all the data values for the almanac. Commented out, too many tests +/* + for(int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; //switch to allow for skipped prn 8 + else x = i + 1; + testMesg = "getEcc returned the wrong value"; + testFramework.assert(std::abs(dataStore.getEcc(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.ecc[i])*1E2 < eps, testMesg, __LINE__); + testMesg = "getIOffset returned the wrong value"; + testFramework.assert(std::abs(dataStore.getIOffset(gpstk::SatID(x, gpstk::SatID::systemGPS)) - (aData.oi[i] - .3*M_PI)) < eps, testMesg, __LINE__); + testMesg = "getOmegadot returned the wrong value"; + testFramework.assert(std::abs(dataStore.getOmegadot(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.rora[i])*1E8 < eps, testMesg, __LINE__); + testMesg = "get6bitHealth returned the wrong value"; + testFramework.assert(dataStore.get6bitHealth(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 0 , testMesg, __LINE__); + testMesg = "getSVHealth returned the wrong value"; + testFramework.assert(dataStore.getSVHealth(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 0, testMesg, __LINE__); + testMesg = "getSVConfig returned the wrong value"; + testFramework.assert(dataStore.getSVConfig(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 9, testMesg, __LINE__); //9 is 1001 + testMesg = "getAhalf returned the wrong value"; + testFramework.assert(std::abs(dataStore.getAhalf(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.sqrta[i])*1E-4 < eps, testMesg, __LINE__); + testMesg = "getA returned the wrong value"; + testFramework.assert(std::abs(dataStore.getA(gpstk::SatID(x, gpstk::SatID::systemGPS)) - pow(aData.sqrta[i],2))*1E-8 < eps, testMesg, __LINE__); + testMesg = "getOmega0 returned the wrong value"; + testFramework.assert(std::abs(dataStore.getOmega0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.raaw[i])*1E-1 < eps, testMesg, __LINE__); + testMesg = "getW returned the wrong value"; + testFramework.assert(std::abs(dataStore.getW(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.aop[i]) < eps, testMesg, __LINE__); + testMesg = "getM0 returned the wrong value"; + testFramework.assert(std::abs(dataStore.getM0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.ma[i])*1E-1 < eps, testMesg, __LINE__); + testMesg = "getAf0 returned the wrong value"; + testFramework.assert(std::abs(dataStore.getAf0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.af0[i])*1E5 < eps, testMesg, __LINE__); + testMesg = "getAf1 returned the wrong value"; + testFramework.assert(std::abs(dataStore.getAf1(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.af1[i]) < eps, testMesg, __LINE__); + } +*/ + + //getEcc test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getEcc(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.ecc[i])*1E2 < eps)) + failCount++; + } + testMesg = "getEcc returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getIOffset test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getIOffset(gpstk::SatID(x, gpstk::SatID::systemGPS)) - (aData.oi[i] - .3*M_PI)) < eps)) + failCount++; + } + testMesg = "getIOffset returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getOmegadot test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getOmegadot(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.rora[i])*1E8 < eps)) + failCount++; + } + testMesg = "getOmegadot returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //get6bitHealth test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(dataStore.get6bitHealth(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 0)) + failCount++; + } + testMesg = "get6bitHealth returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getSVHealth test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(dataStore.getSVHealth(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 0)) + failCount++; + } + testMesg = "getSVHealth returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getSVConfig test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(dataStore.getSVConfig(gpstk::SatID(x, gpstk::SatID::systemGPS)) == 9)) + failCount++; + } + testMesg = "getSVConfig returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getAhalf test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getAhalf(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.sqrta[i])*1E-4 < eps)) + failCount++; + } + testMesg = "getAhalf returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getA test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getA(gpstk::SatID(x, gpstk::SatID::systemGPS)) - pow(aData.sqrta[i],2))*1E-8 < eps)) + failCount++; + } + testMesg = "getA returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getOmega0 test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getOmega0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.raaw[i])*1E-1 < eps)) + failCount++; + } + testMesg = "getOmega0 returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getW test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getW(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.aop[i]) < eps)) + failCount++; + } + testMesg = "getW returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getM0 test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getM0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.ma[i])*1E-1 < eps)) + failCount++; + } + testMesg = "getM0 returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getAf0 test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getAf0(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.af0[i])*1E5 < eps)) + failCount++; + } + testMesg = "getAf0 returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + //getAf1 test + failCount = 0; + for (int i=0; i<31; i++) + { + if ( i >= 7) x = i + 2; + else x = i + 1; + if (!(std::abs(dataStore.getAf1(gpstk::SatID(x, gpstk::SatID::systemGPS)) - aData.af1[i]) < eps)) + failCount++; + } + testMesg = "getAf1 returned the wrong value"; + testFramework.assert(failCount == 0, testMesg, __LINE__); + + double a[4], b[4]; + dataStore.getIon(a, b); + + testMesg = "getIon returned an incorrect value for Alpha0"; + testFramework.assert(std::abs(a[0] + 3.166496753692627e-08) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Alpha1"; + testFramework.assert(std::abs(a[1] + 1.968422573302286e-07) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Alpha2"; + testFramework.assert(std::abs(a[2] + 3.985880685087617e-07) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Alpha3"; + testFramework.assert(std::abs(a[3] + 3.26798013069863e-08) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Beta0"; + testFramework.assert(std::abs(b[0] + 69632) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Beta1"; + testFramework.assert(std::abs(b[1] + 432860.7015445238) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Beta2"; + testFramework.assert(std::abs(b[2] + 424971.8458357919) < eps, testMesg, __LINE__); + testMesg = "getIon returned an incorrect value for Beta3"; + testFramework.assert(std::abs(b[3] + 71863.64306088151) < eps, testMesg, __LINE__); + + double a0, a1, deltaTLS, deltaTLSF; + long tot; + int WNt, WNLSF, DN; + dataStore.getUTC(a0, a1, deltaTLS, tot, WNt, WNLSF, DN, deltaTLSF); + + testMesg = "getUTC returned an incorrect value for A0"; + testFramework.assert(std::abs(a0 + 0.8329656822606921) < eps, testMesg, __LINE__); + testMesg = "getUTC returned an incorrect value for A1"; + testFramework.assert(std::abs(a1 + 4.0241348031599955e-09) < eps, testMesg, __LINE__); + testMesg = "getUTC returned an incorrect value for deltaTLS"; + testFramework.assert(std::abs(deltaTLS - 13) < eps, testMesg, __LINE__); + testMesg = "getUTC returned an incorrect value for deltaTLSF"; + testFramework.assert(std::abs(deltaTLSF + 103) < eps, testMesg, __LINE__); + testMesg = "getUTC returned an incorrect value for Tot"; + testFramework.assert( tot == 450560, testMesg, __LINE__); + testMesg = "getUTC returned an incorrect value for WNt"; + testFramework.assert( WNt == int(851/256)*256 + 90, testMesg, __LINE__); + + //Below test FAILS! in the 8 bit week conversion. Passing unsigned value into + //week conversion can cause diff to be larger than LIMIT[type], resulting in incorrect value + //See EngNav.cpp convertXbit + testMesg = "getUTC returned an incorrect value for WNLSF"; + testFramework.assert( WNLSF == int(851/256)*256 + 254, testMesg, __LINE__); + std::cout<<"WNlsf is: "< 7) x = i+2; + gpstk::AlmOrbit Compare(aData.id[i], aData.ecc[i], (aData.oi[i] - .3*M_PI), aData.rora[i], + aData.sqrta[i], aData.raaw[i], aData.aop[i], aData.ma[i], aData.af0[i], aData.af1[i], + aData.toa[i], 0/*?*/, aData.week[i], aData.health[i]); + gpstk::AlmOrbit orbitData; + orbitData = dataStore.getAlmOrbElem(gpstk::SatID(x, gpstk::SatID::systemGPS)); + +// No == operator for AlmOrbit, using AlmOrbit's get methods to compare +// Too many tests, using counter. Uncomment to find specific error +/* + testMesg = "PRN value in getAlmOrbElem is incorrect"; + testFramework.assert(orbitData.getPRN() == Compare.getPRN(), testMesg, __LINE__); + testMesg = "ecc value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getecc() - Compare.getecc()) < eps, testMesg, __LINE__); + testMesg = "i_offset value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.geti_offset() - Compare.geti_offset()) < eps, testMesg, __LINE__); + testMesg = "OMEGAdot value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getOMEGAdot() - Compare.getOMEGAdot()) < eps, testMesg, __LINE__); + testMesg = "Ahalf value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getAhalf() - Compare.getAhalf()) < eps, testMesg, __LINE__); + testMesg = "OMEGA0 value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getOMEGA0() - Compare.getOMEGA0()) < eps, testMesg, __LINE__); + testMesg = "w value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getw() - Compare.getw()) < eps, testMesg, __LINE__); + testMesg = "M0 value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getM0() - Compare.getM0()) < eps, testMesg, __LINE__); + testMesg = "AF0 value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getAF0() - Compare.getAF0()) < eps, testMesg, __LINE__); + testMesg = "AF1 value in getAlmOrbElem is incorrect"; + testFramework.assert(std::abs(orbitData.getAF1() - Compare.getAF1()) < eps, testMesg, __LINE__); + testMesg = "ToaSOW value in getAlmOrbElem is incorrect"; + testFramework.assert(orbitData.getToaSOW() == Compare.getToaSOW(), testMesg, __LINE__); + testMesg = "xmit_time value in getAlmOrbElem is incorrect"; + testFramework.assert(orbitData.getxmit_time() == Compare.getxmit_time(), testMesg, __LINE__); + testMesg = "ToaWeek value in getAlmOrbElem is incorrect"; + testFramework.assert(orbitData.getToaWeek() == Compare.getToaWeek(), testMesg, __LINE__); +*/ + + if (!(orbitData.getPRN() == Compare.getPRN())) failCount++; + if (!(std::abs(orbitData.getecc() - Compare.getecc()) < eps)) failCount++; + if (!(std::abs(orbitData.geti_offset() - Compare.geti_offset()) < eps)) failCount++; + if (!(std::abs(orbitData.getOMEGAdot() - Compare.getOMEGAdot()) < eps)) failCount++; + if (!(std::abs(orbitData.getAhalf() - Compare.getAhalf()) < eps)) failCount++; + if (!(std::abs(orbitData.getOMEGA0() - Compare.getOMEGA0()) < eps)) failCount++; + if (!(std::abs(orbitData.getw() - Compare.getw()) < eps)) failCount++; + if (!(std::abs(orbitData.getM0() - Compare.getM0()) < eps)) failCount++; + if (!(std::abs(orbitData.getAF0() - Compare.getAF0()) < eps)) failCount++; + if (!(std::abs(orbitData.getAF1() - Compare.getAF1()) < eps)) failCount++; + if (!(orbitData.getToaSOW() == Compare.getToaSOW())) failCount++; + if (!(orbitData.getxmit_time() == Compare.getxmit_time())) failCount++; + if (!(orbitData.getToaWeek() == Compare.getToaWeek())) failCount++; + } + testFramework.assert(failCount == 0, testMesg, __LINE__); + + return testFramework.countFails(); + + } + + private: + double eps; + std::string testMesg; + AlmanacData aData; //data where the almanac info is stored + AlmanacSubframes aSubframes; //data where subframes are stored + }; int main() //Main function to initialize and run all tests above { - return 0; //Return the total number of errors + std::string pathData = gpstk::getPathData(); + std::string almanacLocation = pathData + "/test_input_gps_almanac.txt"; + std::ifstream iAlmanac(almanacLocation.c_str()); // Reads in almanac data from file + AlmanacData iAData(iAlmanac); // Parses file into data objects + AlmanacSubframes iASubframes(iAData); // Takes data objects and generates the subframes needed + + EngAlmanac_T testClass(iAData, iASubframes); + int check, errorCounter = 0; + + check = testClass.addSubframeTest(); // Tests adding the subframes to a class member of EngAlmanac + errorCounter += check; + + check = testClass.getTest(); // Tests the get methods and if subframes stored the correct data + errorCounter += check; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; + + return errorCounter; //Return the total number of errors } diff --git a/core/tests/GNSSEph/EngEphemeris_T.cpp b/core/tests/GNSSEph/EngEphemeris_T.cpp index a783abf88..8cd0ce763 100644 --- a/core/tests/GNSSEph/EngEphemeris_T.cpp +++ b/core/tests/GNSSEph/EngEphemeris_T.cpp @@ -223,6 +223,14 @@ class EngEphemeris_T //: public gpstk::EngEphemeris testMesg = testStream.str(); testStream.str(""); testFramework.assert(badCount == 0, testMesg, __LINE__); + testStream << "Empty ephemeris was incorrectly considered valid."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(Empty.isValid() == false, testMesg, __LINE__); + + testStream << "Empty ephemeris was incorrectly considered complete."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(Empty.isDataSet() == false, testMesg, __LINE__); + return testFramework.countFails(); } @@ -493,6 +501,16 @@ class EngEphemeris_T //: public gpstk::EngEphemeris subframe1Check(dataStore, testFramework); + std::stringstream testStream; + + testStream << "Partially empty ephemeris was incorrectly considered valid."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(dataStore.isValid() == false, testMesg, __LINE__); + + testStream << "Partially empty ephemeris was incorrectly considered complete."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(dataStore.isDataSet() == false, testMesg, __LINE__); + return testFramework.countFails(); } @@ -522,6 +540,12 @@ class EngEphemeris_T //: public gpstk::EngEphemeris subframe2Check(dataStore, testFramework); + std::stringstream testStream; + + testStream << "Partially empty ephemeris was incorrectly considered complete."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(dataStore.isDataSet() == false, testMesg, __LINE__); + return testFramework.countFails(); } @@ -549,6 +573,12 @@ class EngEphemeris_T //: public gpstk::EngEphemeris subframe3Check(dataStore, testFramework); + std::stringstream testStream; + + testStream << "Complete, valid ephemeris was incorrectly considered incomplete."; + testMesg = testStream.str(); testStream.str(""); + testFramework.assert(dataStore.isDataSet() == true, testMesg, __LINE__); + return testFramework.countFails(); } diff --git a/core/tests/Math/Matrix_SVD_T.cpp b/core/tests/Math/Matrix_SVD_T.cpp index 23c21c7b4..c7acd7e81 100644 --- a/core/tests/Math/Matrix_SVD_T.cpp +++ b/core/tests/Math/Matrix_SVD_T.cpp @@ -49,38 +49,38 @@ void SVDinitializer(void) //================================================================================================================= // Below details what the individual matrices of the SVD should be, but currently aren't used in this test -/* gpstk::Matrix A5Temp(2,2), A6Temp(2,3), A7Temp(3,2), A8Temp(3,3); - gpstk::Matrix CompareUA5Temp(2,2), CompareUA6Temp(2,2), CompareUA7Temp(3,3), CompareUA8Temp(3,3), - CompareVA5Temp(2,2), CompareVA6Temp(3,3), CompareVA7Temp(2,2), CompareVA8Temp(3,3); + gpstk::Matrix A5Temp(2,2), A6Temp(2,3), A7Temp(3,2), A8Temp(3,3); +// gpstk::Matrix CompareUA5Temp(2,2), CompareUA6Temp(2,2), CompareUA7Temp(3,3), CompareUA8Temp(3,3), +// CompareVA5Temp(2,2), CompareVA6Temp(3,3), CompareVA7Temp(2,2), CompareVA8Temp(3,3); double temp5[4] = {2,2, 1,-1}; - double temp5S[2] = {1,1}; - double temp5U[4] = {2*pow(2,.5), 0, 0, pow(2,.5)}; - double temp5V[4] = {pow(2,-.5), -1*pow(2,-.5), pow(2,-.5), pow(2,-.5)}; +// double temp5S[2] = {1,1}; +// double temp5U[4] = {2*pow(2,.5), 0, 0, pow(2,.5)}; +// double temp5V[4] = {pow(2,-.5), -1*pow(2,-.5), pow(2,-.5), pow(2,-.5)}; double temp6[6] = {4, 11, 14, 8, 7, -2}; - double temp6S[2] = {6*pow(10,.5), 10*pow(10,.5)}; - double temp6U[4] = {3*pow(10,-.5), pow(10,-.5), pow(10,.5), -3*pow(10,-.5)}; - double temp6V[9] = {1./3, -2./3, 2./3, 2./3, -1./3, -2./3, 2./3, 2./3, 1./3}; +// double temp6S[2] = {6*pow(10,.5), 10*pow(10,.5)}; +// double temp6U[4] = {3*pow(10,-.5), pow(10,-.5), pow(10,.5), -3*pow(10,-.5)}; +// double temp6V[9] = {1./3, -2./3, 2./3, 2./3, -1./3, -2./3, 2./3, 2./3, 1./3}; double temp7[6] = {1, -1, -2, 2, 2, -2}; - double temp7S[3] = {3*pow(2,.5), 0}; - double temp7U[9] = {1./3, 2*pow(5,-.5), -2*pow(45,.5), -2./3, pow(5,-.5), 4*pow(45,-.5), 2./3, 0, 5*pow(45,-.5)}; - double temp7V[4] = {pow(2,-.5), -1*pow(2,-.5), pow(2,-.5), pow(2,-.5)}; +// double temp7S[3] = {3*pow(2,.5), 0}; +// double temp7U[9] = {1./3, 2*pow(5,-.5), -2*pow(45,.5), -2./3, pow(5,-.5), 4*pow(45,-.5), 2./3, 0, 5*pow(45,-.5)}; +// double temp7V[4] = {pow(2,-.5), -1*pow(2,-.5), pow(2,-.5), pow(2,-.5)}; double temp8[9] = {-1,2,2, 2,2,-1, 2,-1,2}; - double temp8S[3] = {3,3,3}; - double temp8U[9] = {-1./3, 2./3, 2./3, 2./3, 2./3, -1./3, 2./3, -1./3, 2./3}; - double temp8V[9] = {1,0,0,0,1,0,0,0,1}; +// double temp8S[3] = {3,3,3}; +// double temp8U[9] = {-1./3, 2./3, 2./3, 2./3, 2./3, -1./3, 2./3, -1./3, 2./3}; +// double temp8V[9] = {1,0,0,0,1,0,0,0,1}; A5Temp = temp5; A6Temp = temp6; A7Temp = temp7; A8Temp = temp8; - CompareUA5Temp = temp5U; CompareUA6Temp = temp6U; CompareUA7Temp = temp7U; CompareUA8Temp = temp8U; - CompareVA5Temp = temp5V; CompareVA6Temp = temp6V; CompareVA7Temp = temp7V; CompareVA8Temp = temp8V; +// CompareUA5Temp = temp5U; CompareUA6Temp = temp6U; CompareUA7Temp = temp7U; CompareUA8Temp = temp8U; +// CompareVA5Temp = temp5V; CompareVA6Temp = temp6V; CompareVA7Temp = temp7V; CompareVA8Temp = temp8V; A5 = A5Temp; A6 = A6Temp; A7 = A7Temp; A8 = A8Temp; - CompareUA5 = CompareUA5Temp; CompareUA6 = CompareUA6Temp; CompareUA7 = CompareUA7Temp; CompareUA8 = CompareUA8Temp; - CompareVA5 = CompareVA5Temp; CompareVA6 = CompareVA6Temp; CompareVA7 = CompareVA7Temp; CompareVA8 = CompareVA8Temp; -*/ +// CompareUA5 = CompareUA5Temp; CompareUA6 = CompareUA6Temp; CompareUA7 = CompareUA7Temp; CompareUA8 = CompareUA8Temp; +// CompareVA5 = CompareVA5Temp; CompareVA6 = CompareVA6Temp; CompareVA7 = CompareVA7Temp; CompareVA8 = CompareVA8Temp; + //=================================================================================================================== SVD5(A5); SVD6(A6); SVD7(A7); SVD8(A8); @@ -95,19 +95,19 @@ gpstk::Matrix SMatrixGeneration(gpstk::Matrix U, gpstk::Matrix sMartix(sRows,sCols); + gpstk::Matrix sMatrix(sRows,sCols); for (int i=0; i < (sRows); i++) { for (int j=0; j < (sCols); j++) { - sMartix(i,j) = 0; - if (i == j) sMartix(i,j) = vect(i); + sMatrix(i,j) = 0; + if (i == j) sMatrix(i,j) = vect(i); } } - //std::cout< Operator", __FILE__, __LINE__); + std::string testMesg; + ReferenceFrame rf1(ReferenceFrame::Unknown); ReferenceFrame rf2(ReferenceFrame::WGS84); ReferenceFrame rf3(ReferenceFrame::PZ90); @@ -137,29 +174,37 @@ void ReferenceFrame_T::greaterThanTest() ReferenceFrame rf5("WGS84"); ReferenceFrame rf6("PZ90"); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf3 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf6 )); - - CPPUNIT_ASSERT( rf2 > rf1 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf3 )); - CPPUNIT_ASSERT( rf2 > rf4 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf6 )); - - CPPUNIT_ASSERT( rf3 > rf1 ); - CPPUNIT_ASSERT( rf3 > rf2 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 > rf3 )); - CPPUNIT_ASSERT( rf3 > rf4 ); - CPPUNIT_ASSERT( rf3 > rf5 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 > rf6 )); + testMesg = " > operator failed with Unknown"; + testFramework.assert( !(rf1 > rf1) , testMesg, __LINE__); + testFramework.assert( !(rf1 > rf2) , testMesg, __LINE__); + testFramework.assert( !(rf1 > rf3) , testMesg, __LINE__); + testFramework.assert( !(rf1 > rf4) , testMesg, __LINE__); + testFramework.assert( !(rf1 > rf5) , testMesg, __LINE__); + testFramework.assert( !(rf1 > rf6) , testMesg, __LINE__); + + testMesg = " > operator failed with WGS84"; + testFramework.assert( (rf2 > rf1) , testMesg, __LINE__); + testFramework.assert( !(rf2 > rf2) , testMesg, __LINE__); + testFramework.assert( !(rf2 > rf3) , testMesg, __LINE__); + testFramework.assert( (rf2 > rf4) , testMesg, __LINE__); + testFramework.assert( !(rf2 > rf5) , testMesg, __LINE__); + testFramework.assert( !(rf2 > rf6) , testMesg, __LINE__); + + testMesg = " > operator failed with PZ90"; + testFramework.assert( (rf3 > rf1) , testMesg, __LINE__); + testFramework.assert( (rf3 > rf2) , testMesg, __LINE__); + testFramework.assert( !(rf3 > rf3) , testMesg, __LINE__); + testFramework.assert( (rf3 > rf4) , testMesg, __LINE__); + testFramework.assert( (rf3 > rf5) , testMesg, __LINE__); + testFramework.assert( !(rf3 > rf6) , testMesg, __LINE__); + + return testFramework.countFails(); } -void ReferenceFrame_T::lessThanTest() +int lessThanTest(void) { + TestUtil testFramework("ReferenceFrame", "< Operator", __FILE__, __LINE__); + std::string testMesg; + ReferenceFrame rf1(ReferenceFrame::Unknown); ReferenceFrame rf2(ReferenceFrame::WGS84); ReferenceFrame rf3(ReferenceFrame::PZ90); @@ -167,29 +212,37 @@ void ReferenceFrame_T::lessThanTest() ReferenceFrame rf5("WGS84"); ReferenceFrame rf6("PZ90"); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 < rf1 )); - CPPUNIT_ASSERT( rf1 < rf2 ); - CPPUNIT_ASSERT( rf1 < rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 < rf4 )); - CPPUNIT_ASSERT( rf1 < rf5 ); - CPPUNIT_ASSERT( rf1 < rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf2 )); - CPPUNIT_ASSERT( rf2 < rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf5 )); - CPPUNIT_ASSERT( rf2 < rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf3 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf6 )); + testMesg = " < operator failed with Unknown"; + testFramework.assert( !(rf1 < rf1) , testMesg, __LINE__); + testFramework.assert( rf1 < rf2 , testMesg, __LINE__); + testFramework.assert( rf1 < rf3 , testMesg, __LINE__); + testFramework.assert( !(rf1 < rf4) , testMesg, __LINE__); + testFramework.assert( rf1 < rf5 , testMesg, __LINE__); + testFramework.assert( rf1 < rf6 , testMesg, __LINE__); + + testMesg = " < operator failed with WGS84"; + testFramework.assert( !(rf2 < rf1) , testMesg, __LINE__); + testFramework.assert( !(rf2 < rf2) , testMesg, __LINE__); + testFramework.assert( (rf2 < rf3) , testMesg, __LINE__); + testFramework.assert( !(rf2 < rf4) , testMesg, __LINE__); + testFramework.assert( !(rf2 < rf5) , testMesg, __LINE__); + testFramework.assert( (rf2 < rf6) , testMesg, __LINE__); + + testMesg = " < operator failed with PZ90"; + testFramework.assert( !(rf3 < rf1) , testMesg, __LINE__); + testFramework.assert( !(rf3 < rf2) , testMesg, __LINE__); + testFramework.assert( !(rf3 < rf3) , testMesg, __LINE__); + testFramework.assert( !(rf3 < rf4) , testMesg, __LINE__); + testFramework.assert( !(rf3 < rf5) , testMesg, __LINE__); + testFramework.assert( !(rf3 < rf6) , testMesg, __LINE__); + + return testFramework.countFails(); } -void ReferenceFrame_T::greaterThanOrEqualToTest() +int greaterThanOrEqualToTest(void) { + TestUtil testFramework("ReferenceFrame", ">= Operator", __FILE__, __LINE__); + std::string testMesg; + ReferenceFrame rf1(ReferenceFrame::Unknown); ReferenceFrame rf2(ReferenceFrame::WGS84); ReferenceFrame rf3(ReferenceFrame::PZ90); @@ -198,29 +251,37 @@ void ReferenceFrame_T::greaterThanOrEqualToTest() ReferenceFrame rf6("PZ90"); //Unknown with... - CPPUNIT_ASSERT( rf1 >= rf1 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf2 ))); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf3 ))); - CPPUNIT_ASSERT( rf1 >= rf4 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf5 ))); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf6 ))); - - CPPUNIT_ASSERT( rf2 >= rf1 ); - CPPUNIT_ASSERT( rf2 >= rf2 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf2 >= rf3 ))); - CPPUNIT_ASSERT( rf2 >= rf4 ); - CPPUNIT_ASSERT( rf2 >= rf5 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf2 >= rf6 ))); - - CPPUNIT_ASSERT( rf3 >= rf1 ); - CPPUNIT_ASSERT( rf3 >= rf2 ); - CPPUNIT_ASSERT( rf3 >= rf3 ); - CPPUNIT_ASSERT( rf3 >= rf4 ); - CPPUNIT_ASSERT( rf3 >= rf5 ); - CPPUNIT_ASSERT( rf3 >= rf6 ); + testMesg = " >= operator failed with Unknown"; + testFramework.assert( rf1 >= rf1 , testMesg, __LINE__); + testFramework.assert( !(rf1 >= rf2) , testMesg, __LINE__); + testFramework.assert( !(rf1 >= rf3) , testMesg, __LINE__); + testFramework.assert( rf1 >= rf4 , testMesg, __LINE__); + testFramework.assert( !(rf1 >= rf5) , testMesg, __LINE__); + testFramework.assert( !(rf1 >= rf6) , testMesg, __LINE__); + + testMesg = " >= operator failed with WGS84"; + testFramework.assert( rf2 >= rf1 , testMesg, __LINE__); + testFramework.assert( rf2 >= rf2 , testMesg, __LINE__); + testFramework.assert( !(rf2 >= rf3) , testMesg, __LINE__); + testFramework.assert( rf2 >= rf4 , testMesg, __LINE__); + testFramework.assert( rf2 >= rf5 , testMesg, __LINE__); + testFramework.assert( !(rf2 >= rf6) , testMesg, __LINE__); + + testMesg = " >= operator failed with PZ90"; + testFramework.assert( rf3 >= rf1 , testMesg, __LINE__); + testFramework.assert( rf3 >= rf2 , testMesg, __LINE__); + testFramework.assert( rf3 >= rf3 , testMesg, __LINE__); + testFramework.assert( rf3 >= rf4 , testMesg, __LINE__); + testFramework.assert( rf3 >= rf5 , testMesg, __LINE__); + testFramework.assert( rf3 >= rf6 , testMesg, __LINE__); + + return testFramework.countFails(); } -void ReferenceFrame_T::lesserThanOrEqualToTest() +int lesserThanOrEqualToTest(void) { + TestUtil testFramework("ReferenceFrame", "<= Operator", __FILE__, __LINE__); + std::string testMesg; + ReferenceFrame rf1(ReferenceFrame::Unknown); ReferenceFrame rf2(ReferenceFrame::WGS84); ReferenceFrame rf3(ReferenceFrame::PZ90); @@ -228,91 +289,140 @@ void ReferenceFrame_T::lesserThanOrEqualToTest() ReferenceFrame rf5("WGS84"); ReferenceFrame rf6("PZ90"); - CPPUNIT_ASSERT( rf1 <= rf1 ); - CPPUNIT_ASSERT( rf1 <= rf2 ); - CPPUNIT_ASSERT( rf1 <= rf3 ); - CPPUNIT_ASSERT( rf1 <= rf4 ); - CPPUNIT_ASSERT( rf1 <= rf5 ); - CPPUNIT_ASSERT( rf1 <= rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 <= rf1 )); - CPPUNIT_ASSERT( rf2 <= rf2 ); - CPPUNIT_ASSERT( rf2 <= rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 <= rf4 )); - CPPUNIT_ASSERT( rf2 <= rf5 ); - CPPUNIT_ASSERT( rf2 <= rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf2 )); - CPPUNIT_ASSERT( rf3 <= rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf5 )); - CPPUNIT_ASSERT( rf3 <= rf6 ); + testMesg = " <= operator failed with Unknown"; + testFramework.assert( rf1 <= rf1 , testMesg, __LINE__); + testFramework.assert( rf1 <= rf2 , testMesg, __LINE__); + testFramework.assert( rf1 <= rf3 , testMesg, __LINE__); + testFramework.assert( rf1 <= rf4 , testMesg, __LINE__); + testFramework.assert( rf1 <= rf5 , testMesg, __LINE__); + testFramework.assert( rf1 <= rf6 , testMesg, __LINE__); + + testMesg = " <= operator failed with WGS84"; + testFramework.assert( !(rf2 <= rf1) , testMesg, __LINE__); + testFramework.assert( rf2 <= rf2 , testMesg, __LINE__); + testFramework.assert( rf2 <= rf3 , testMesg, __LINE__); + testFramework.assert( !(rf2 <= rf4) , testMesg, __LINE__); + testFramework.assert( rf2 <= rf5 , testMesg, __LINE__); + testFramework.assert( rf2 <= rf6 , testMesg, __LINE__); + + testMesg = " <= operator failed with PZ90"; + testFramework.assert( !(rf3 <= rf1) , testMesg, __LINE__); + testFramework.assert( !(rf3 <= rf2) , testMesg, __LINE__); + testFramework.assert( rf3 <= rf3 , testMesg, __LINE__); + testFramework.assert( !(rf3 <= rf4) , testMesg, __LINE__); + testFramework.assert( !(rf3 <= rf5) , testMesg, __LINE__); + testFramework.assert( rf3 <= rf6 , testMesg, __LINE__); + + return testFramework.countFails(); } -void ReferenceFrame_T::setReferenceFrameTest() +int setReferenceFrameTest(void) { + TestUtil testFramework("ReferenceFrame", "ReferenceFrame", __FILE__, __LINE__); + std::string testMesg; + ReferenceFrame rf1(ReferenceFrame::Unknown); ReferenceFrame rf2(ReferenceFrame::WGS84); ReferenceFrame rf3(ReferenceFrame::PZ90); + testMesg = "setReferenceFrame failed"; ReferenceFrame frame(ReferenceFrame::Unknown); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame((ReferenceFrame::Frames)0); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame("Unknown"); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame("A Junk String that won't match up"); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame((ReferenceFrame::Frames)-1); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame((ReferenceFrame::Frames)-1); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame == rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame(ReferenceFrame::WGS84); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame == rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame("WGS84"); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame == rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame((ReferenceFrame::Frames)1); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame == rf2, testMesg, __LINE__); + testFramework.assert(frame != rf3, testMesg, __LINE__); frame = ReferenceFrame(ReferenceFrame::PZ90); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame == rf3, testMesg, __LINE__); frame = ReferenceFrame("PZ90"); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame == rf3, testMesg, __LINE__); frame = ReferenceFrame((ReferenceFrame::Frames)6); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); + testFramework.assert(frame != rf1, testMesg, __LINE__); + testFramework.assert(frame != rf2, testMesg, __LINE__); + testFramework.assert(frame == rf3, testMesg, __LINE__); + + return testFramework.countFails(); +} +}; + +int main(void) +{ + ReferenceFrame_T testClass; + int check, errorCounter = 0; + + check = testClass.getFrameTest(); + errorCounter += check; + + check = testClass.asStringTest(); + errorCounter += check; + + check = testClass.equalityTest(); + errorCounter += check; + + check = testClass.inequalityTest(); + errorCounter += check; + + check = testClass.greaterThanTest(); + errorCounter += check; + + check = testClass.lessThanTest(); + errorCounter += check; + + check = testClass.greaterThanOrEqualToTest(); + errorCounter += check; + + check = testClass.lesserThanOrEqualToTest(); + errorCounter += check; + + check = testClass.setReferenceFrameTest(); + errorCounter += check; + + std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; + + return errorCounter; } diff --git a/core/tests/RefTime/ReferenceFrame_T.hpp b/core/tests/RefTime/ReferenceFrame_T.hpp deleted file mode 100755 index c40750459..000000000 --- a/core/tests/RefTime/ReferenceFrame_T.hpp +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -#ifndef X_REFERENCE_FRAME_HPP -#define X_REFERENCE_FRAME_HPP - -#include -#include -#include "ReferenceFrame.hpp" -namespace gpstk{ - class ReferenceFrame_T : public CPPUNIT_NS :: TestFixture - { - CPPUNIT_TEST_SUITE (ReferenceFrame_T); - CPPUNIT_TEST (getFrameTest); - CPPUNIT_TEST (asStringTest); - CPPUNIT_TEST (equalityTest); - CPPUNIT_TEST (inequalityTest); - CPPUNIT_TEST (greaterThanTest); - CPPUNIT_TEST (greaterThanOrEqualToTest); - CPPUNIT_TEST (lessThanTest); - CPPUNIT_TEST (lesserThanOrEqualToTest); - CPPUNIT_TEST (setReferenceFrameTest); - CPPUNIT_TEST_SUITE_END (); - - public: - void setUp(void) { }; - void tearDown(void) { }; - - protected: - void getFrameTest(); - void asStringTest(); - void equalityTest(); - void inequalityTest(); - void greaterThanTest(); - void lessThanTest(); - void greaterThanOrEqualToTest(); - void lesserThanOrEqualToTest(); - void setReferenceFrameTest(); - - }; -} -#endif diff --git a/core/tests/TimeHandling/CommonTime_T.cpp b/core/tests/TimeHandling/CommonTime_T.cpp index ca82684b9..482b33d27 100755 --- a/core/tests/TimeHandling/CommonTime_T.cpp +++ b/core/tests/TimeHandling/CommonTime_T.cpp @@ -400,10 +400,10 @@ class CommonTime_T : public CommonTime //---------------------------------------- // Set in different ways //---------------------------------------- - Test1.set(700001,1,.1); - Test2.set(700001,1.1); - Test3.set(700001 + dec); - Test4.setInternal(700001,1100,0.); + Test1.set(700001,1,.1); //Set with set(long day,long sod,double fsod,TimeSystem timeSystem = TimeSystem::Unknown ) + Test2.set(700001,1.1); //Set with set(long day,double sod,TimeSystem timeSystem = TimeSystem::Unknown ) + Test3.set(700001 + dec); //Set with set(double day,TimeSystem timeSys = TimeSystem::Unknown ) + Test4.setInternal(700001,1100,0.); //Set with setInternal(long day,long msod,double fsod,TimeSystem timeSys = TimeSystem::Unknown ); //Load up compare variables Test1.get(day,sod,fsod); diff --git a/core/tests/TimeHandling/GPSWeekSecond_T.cpp b/core/tests/TimeHandling/GPSWeekSecond_T.cpp index 4f748f889..2490a7000 100755 --- a/core/tests/TimeHandling/GPSWeekSecond_T.cpp +++ b/core/tests/TimeHandling/GPSWeekSecond_T.cpp @@ -259,6 +259,9 @@ class GPSWeekSecond_T testFramework.assert(Test2.week==Compare.week, "Week provided found to be different after converting to and from CommonTime", __LINE__); testFramework.assert(Test2.sow==Compare.sow, "Second provided found to be different after converting to and from CommonTime", __LINE__); + // @note - This failed before comparison operators were added to GPSWeekSecond + testFramework.assert(Test2 == Test, "Test implicit conversion to/from CommonTime", __LINE__); + return testFramework.countFails(); } diff --git a/core/tests/Utilities/BinUtils_T.cpp b/core/tests/Utilities/BinUtils_T.cpp index 0f5bffe0e..e795b5887 100644 --- a/core/tests/Utilities/BinUtils_T.cpp +++ b/core/tests/Utilities/BinUtils_T.cpp @@ -37,6 +37,7 @@ #include "BinUtils.hpp" #include "Exception.hpp" #include +#include class BinUtils_T { @@ -189,9 +190,9 @@ class BinUtils_T testFramework.assert(b1 == b, failMesg, __LINE__); testFramework.assert(c1 == c, failMesg, __LINE__); testFramework.assert(d1 == d, failMesg, __LINE__); - testFramework.assert(abs(e1-e) < 1e-50, failMesg, __LINE__); - testFramework.assert(abs(f1-f) < 1e-50, failMesg, __LINE__); - testFramework.assert(abs(g1-g) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(e1-e) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(f1-f) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(g1-g) < 1e-50, failMesg, __LINE__); gpstk::BinUtils::twiddle(a); gpstk::BinUtils::twiddle(b); @@ -215,9 +216,9 @@ class BinUtils_T testFramework.assert(b1 == b, failMesg, __LINE__); testFramework.assert(c1 == c, failMesg, __LINE__); testFramework.assert(d1 == d, failMesg, __LINE__); - testFramework.assert(abs(e1-e) < 1e-50, failMesg, __LINE__); - testFramework.assert(abs(f1-f) < 1e-50, failMesg, __LINE__); - testFramework.assert(abs(g1-g) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(e1-e) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(f1-f) < 1e-50, failMesg, __LINE__); + testFramework.assert(std::abs(g1-g) < 1e-50, failMesg, __LINE__); return testFramework.countFails(); } @@ -246,20 +247,23 @@ class BinUtils_T testFramework.assert(stringTest == "andom", failMesg, __LINE__); std::string stringTest0 = "Random"; - char out0 = gpstk::BinUtils::decodeVar(stringTest0,0); + char out0 = gpstk::BinUtils::decodeVar(stringTest0, 0); failMesg = "The method did not parse the proper value"; testFramework.assert(out0 == 0x52, failMesg, __LINE__); std::string stringTest1 = "I am 5000."; - int out1 = gpstk::BinUtils::decodeVar(stringTest1,5); + int out1 = gpstk::BinUtils::decodeVar(stringTest1, 5); - testFramework.assert(out1 == 0x35303030, failMesg, __LINE__); // '5000' + unsigned iexpected = 0x35303030; // '5000' as ascii bytes + testFramework.assert(out1 == iexpected, failMesg, __LINE__); // '5000' std::string stringTest2 = "The word 'this' should be read"; float out2 = gpstk::BinUtils::decodeVar(stringTest2, 10); - testFramework.assert(abs(out2 - 0x74686973) < 1e-12, failMesg, __LINE__); // 'this' + unsigned bytes = 0x74686973; // 'this' as ascii bytes + float fexpected = *(float*)&bytes; // interpret bytes as a float + testFramework.assert(std::abs(out2 - fexpected) < 1e-12, failMesg, __LINE__); return testFramework.countFails(); } diff --git a/core/tests/Utilities/StringUtils_T.cpp b/core/tests/Utilities/StringUtils_T.cpp index 4ced178d8..e4f671d3f 100644 --- a/core/tests/Utilities/StringUtils_T.cpp +++ b/core/tests/Utilities/StringUtils_T.cpp @@ -49,898 +49,915 @@ using namespace std; class StringUtils_T { - public: - StringUtils_T() {} - ~StringUtils_T() {} +public: + StringUtils_T() {} + ~StringUtils_T() {} /* ========================================================================================================================= - Tests for the justification methods - Given a baseString and a filler character, the tests will justify the - string to a new string of the size of the original string + 6. -========================================================================================================================= */ - int justificationTest( void ) - { - TestUtil testFramework( "StringUtils", "Justify", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString= "1234567890"; //base string to manipulate - string resultString; //storage for the correct response - string manipulatedString; //storage for the manipulated base string - char fillerChar = '-'; - - manipulatedString = baseString; - resultString = string(6, fillerChar) + baseString; - //Add six filler characters to the front of the string - rightJustify(manipulatedString, manipulatedString.length() + 6, fillerChar); - - failMesg = "Verify that rightJustify works by appending 6 '-'s to the left"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString + string(6, fillerChar); - //Add six filler characters to the end of the string - leftJustify(manipulatedString, manipulatedString.length()+6, fillerChar); - - failMesg = "Verify that leftJustify works by appending 6 '-'s to the right"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + Tests for the justification methods + Given a baseString and a filler character, the tests will justify the + string to a new string of the size of the original string + 6. + ========================================================================================================================= */ + int justificationTest( void ) + { + TestUtil testFramework( "StringUtils", "Justify", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString= "1234567890"; //base string to manipulate + string resultString; //storage for the correct response + string manipulatedString; //storage for the manipulated base string + char fillerChar = '-'; + + manipulatedString = baseString; + resultString = string(6, fillerChar) + baseString; + //Add six filler characters to the front of the string + rightJustify(manipulatedString, manipulatedString.length() + 6, fillerChar); + + failMesg = "Verify that rightJustify works by appending 6 '-'s to the left"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString + string(6, fillerChar); + //Add six filler characters to the end of the string + leftJustify(manipulatedString, manipulatedString.length()+6, fillerChar); + + failMesg = "Verify that leftJustify works by appending 6 '-'s to the right"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - manipulatedString = baseString; - resultString = string(3, fillerChar) + baseString + string(3, fillerChar); - //Add three filler characters to both ends of the string - center(manipulatedString, manipulatedString.length()+6, fillerChar); + manipulatedString = baseString; + resultString = string(3, fillerChar) + baseString + string(3, fillerChar); + //Add three filler characters to both ends of the string + center(manipulatedString, manipulatedString.length()+6, fillerChar); - failMesg = "Verify that leftJustify works by appending 3 '-'s to both sides"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + failMesg = "Verify that leftJustify works by appending 3 '-'s to both sides"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the stripLeading methods - Given a baseString and a filler character and string, the tests will strip the - baseString of the request string or character from the front of the string. -========================================================================================================================= */ - int stripLeadingTest( void ) - { - TestUtil testFramework( "StringUtils", "stripLeading", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString= "---1234567890---"; //base string to manipulate - string resultString; //storage for the correct response - string manipulatedString; //storage for the manipulated base string - char charToBeRemoved = '-'; - string stringToBeRemoved = "--"; - - manipulatedString = baseString; - resultString = baseString.substr(1,string::npos); - //Strip one of the character -'s from the beginning of the string - manipulatedString = stripLeading(manipulatedString, charToBeRemoved, 1); - - failMesg = "Verify that stripLeading works by removing 1 '-' from the beginning of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(2,string::npos); - //Strip one of the string --'s from the beginning of the string - manipulatedString = stripLeading(manipulatedString, stringToBeRemoved, 1); - - failMesg = "Verify that stripLeading works by removing 1 '--' from the beginning of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(3,string::npos); - //Strip all of the character -'s from the beginning of the string - manipulatedString = stripLeading(manipulatedString, charToBeRemoved); - - failMesg = "Verify that stripLeading works by removing all '-' from the beginning of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(2,string::npos); - //Strip all of the string --'s from the beginning of the string - manipulatedString = stripLeading(manipulatedString, stringToBeRemoved); - - failMesg = "Verify that stripLeading works by removing all '--' from the beginning of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + Tests for the stripLeading methods + Given a baseString and a filler character and string, the tests will strip the + baseString of the request string or character from the front of the string. + ========================================================================================================================= */ + int stripLeadingTest( void ) + { + TestUtil testFramework( "StringUtils", "stripLeading", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString= "---1234567890---"; //base string to manipulate + string resultString; //storage for the correct response + string manipulatedString; //storage for the manipulated base string + char charToBeRemoved = '-'; + string stringToBeRemoved = "--"; + + manipulatedString = baseString; + resultString = baseString.substr(1,string::npos); + //Strip one of the character -'s from the beginning of the string + manipulatedString = stripLeading(manipulatedString, charToBeRemoved, 1); + + failMesg = "Verify that stripLeading works by removing 1 '-' from the beginning of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(2,string::npos); + //Strip one of the string --'s from the beginning of the string + manipulatedString = stripLeading(manipulatedString, stringToBeRemoved, 1); + + failMesg = "Verify that stripLeading works by removing 1 '--' from the beginning of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(3,string::npos); + //Strip all of the character -'s from the beginning of the string + manipulatedString = stripLeading(manipulatedString, charToBeRemoved); + + failMesg = "Verify that stripLeading works by removing all '-' from the beginning of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(2,string::npos); + //Strip all of the string --'s from the beginning of the string + manipulatedString = stripLeading(manipulatedString, stringToBeRemoved); + + failMesg = "Verify that stripLeading works by removing all '--' from the beginning of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the stripTrailing methods - Given a baseString and a filler character and string, the tests will strip the - baseString of the request string or character from the end of the string. -========================================================================================================================= */ - int stripTrailingTest( void ) - { - TestUtil testFramework( "StringUtils", "stripTrailing", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString= "---1234567890---"; //base string to manipulate - string resultString; //storage for the correct response - string manipulatedString; //storage for the manipulated base string - char charToBeRemoved = '-'; - string stringToBeRemoved = "--"; - - manipulatedString = baseString; - resultString = baseString.substr(0, baseString.length()-1); - //Strip one of the character -'s from the end of the string - manipulatedString = stripTrailing(manipulatedString, charToBeRemoved, 1); - - failMesg = "Verify that stripTrailing works by removing 1 '-' from the end of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(0, baseString.length()-2); - //Strip one of the string --'s from the end of the string - manipulatedString = stripTrailing(manipulatedString, stringToBeRemoved, 1); - - failMesg = "Verify that stripTrailing works by removing 1 '--' from the end of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(0, baseString.length()-3); - //Strip all of the character -'s from the end of the string - manipulatedString = stripTrailing(manipulatedString, charToBeRemoved); - - failMesg = "Verify that stripTrailing works by removing all '-' from the end of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(0, baseString.length()-2); - //Strip all of the string --'s from the end of the string - manipulatedString = stripTrailing(manipulatedString, stringToBeRemoved); - - failMesg = "Verify that stripTrailing works by removing all '--' from the end of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + Tests for the stripTrailing methods + Given a baseString and a filler character and string, the tests will strip the + baseString of the request string or character from the end of the string. + ========================================================================================================================= */ + int stripTrailingTest( void ) + { + TestUtil testFramework( "StringUtils", "stripTrailing", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString= "---1234567890---"; //base string to manipulate + string resultString; //storage for the correct response + string manipulatedString; //storage for the manipulated base string + char charToBeRemoved = '-'; + string stringToBeRemoved = "--"; + + manipulatedString = baseString; + resultString = baseString.substr(0, baseString.length()-1); + //Strip one of the character -'s from the end of the string + manipulatedString = stripTrailing(manipulatedString, charToBeRemoved, 1); + + failMesg = "Verify that stripTrailing works by removing 1 '-' from the end of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(0, baseString.length()-2); + //Strip one of the string --'s from the end of the string + manipulatedString = stripTrailing(manipulatedString, stringToBeRemoved, 1); + + failMesg = "Verify that stripTrailing works by removing 1 '--' from the end of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(0, baseString.length()-3); + //Strip all of the character -'s from the end of the string + manipulatedString = stripTrailing(manipulatedString, charToBeRemoved); + + failMesg = "Verify that stripTrailing works by removing all '-' from the end of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(0, baseString.length()-2); + //Strip all of the string --'s from the end of the string + manipulatedString = stripTrailing(manipulatedString, stringToBeRemoved); + + failMesg = "Verify that stripTrailing works by removing all '--' from the end of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the strip method - Given a baseString and a filler character and string, the tests will strip the - baseString of the request string or character from both ends of the string. -========================================================================================================================= */ - int stripTest( void ) - { - TestUtil testFramework( "StringUtils", "strip", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString= "---1234567890---"; //base string to manipulate - string resultString; //storage for the correct response - string manipulatedString; //storage for the manipulated base string - char charToBeRemoved = '-'; - string stringToBeRemoved = "--"; - - manipulatedString = baseString; - resultString = baseString.substr(1,baseString.length()-2); - //Strip one of the character -'s from both ends of the string - manipulatedString = strip(manipulatedString, charToBeRemoved, 1); - - failMesg = "Verify that strip works by removing 1 '-' from both ends of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(2,baseString.length()-4); - //Strip one of the string --'s from both ends of the string - manipulatedString = strip(manipulatedString, stringToBeRemoved, 1); - - failMesg = "Verify that strip works by removing 1 '--' from both ends of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(3, baseString.length()-6); - //Strip all of the character -'s from both ends of the string - manipulatedString = strip(manipulatedString, charToBeRemoved); - - failMesg = "Verify that strip works by removing all '-' from both ends of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - - manipulatedString = baseString; - resultString = baseString.substr(2, baseString.length()-4); - //Strip all of the string --'s from both ends of the string - manipulatedString = strip(manipulatedString, stringToBeRemoved); - - failMesg = "Verify that strip works by removing all '--' from both ends of the string"; - testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + Tests for the strip method + Given a baseString and a filler character and string, the tests will strip the + baseString of the request string or character from both ends of the string. + ========================================================================================================================= */ + int stripTest( void ) + { + TestUtil testFramework( "StringUtils", "strip", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString= "---1234567890---"; //base string to manipulate + string resultString; //storage for the correct response + string manipulatedString; //storage for the manipulated base string + char charToBeRemoved = '-'; + string stringToBeRemoved = "--"; + + manipulatedString = baseString; + resultString = baseString.substr(1,baseString.length()-2); + //Strip one of the character -'s from both ends of the string + manipulatedString = strip(manipulatedString, charToBeRemoved, 1); + + failMesg = "Verify that strip works by removing 1 '-' from both ends of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(2,baseString.length()-4); + //Strip one of the string --'s from both ends of the string + manipulatedString = strip(manipulatedString, stringToBeRemoved, 1); + + failMesg = "Verify that strip works by removing 1 '--' from both ends of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(3, baseString.length()-6); + //Strip all of the character -'s from both ends of the string + manipulatedString = strip(manipulatedString, charToBeRemoved); + + failMesg = "Verify that strip works by removing all '-' from both ends of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); + + manipulatedString = baseString; + resultString = baseString.substr(2, baseString.length()-4); + //Strip all of the string --'s from both ends of the string + manipulatedString = strip(manipulatedString, stringToBeRemoved); + + failMesg = "Verify that strip works by removing all '--' from both ends of the string"; + testFramework.assert(manipulatedString == resultString, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the translate method - Given a baseString and a translation strings, the baseString will be "translated" - using those translation strings. -========================================================================================================================= */ - int translateTest( void ) - { - TestUtil testFramework( "StringUtils", "strip", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString = "Hello World! I am the Translation test String!"; //Original String to replace characters on - string manipulatedString; //storage for manipulated base string - string translateFrom = "aeoWTS!"; //Characters to replace - string translateTo1 = "@30M7Q1"; //Characters that will replace the ones in translateFrom - string expectedResult1 = "H3ll0 M0rld1 I @m th3 7r@nsl@ti0n t3st Qtring1"; //Correctly translated base string with translateTo1 - string translateTo2 = "@30M7"; //Characters that will replace the ones in translateFrom - string expectedResult2 = "H3ll0 M0rld I @m th3 7r@nsl@ti0n t3st tring "; //Correctly translated base string with translateTo2 - string translateTo3 = "aeoWTS!"; //Characters that will replace the ones in translateFrom - string expectedResult3 = "Hello World! I am the Translation test String!"; //Correctly translated base string with translateTo3 - - manipulatedString = translate(baseString, translateFrom, translateTo1); - failMesg = "Verify that translate works by changing multiple characters"; - testFramework.assert(manipulatedString == expectedResult1, failMesg, __LINE__); - - manipulatedString = translate(baseString, translateFrom, translateTo2); - failMesg = "Verify that translate replaces unmatched characters with blanks"; - testFramework.assert(manipulatedString == expectedResult2, failMesg, __LINE__); - - manipulatedString = translate(baseString, translateFrom, translateTo3); - failMesg = "Verify that translate won't change things when supplied the same set of characters"; - testFramework.assert(manipulatedString == expectedResult3, failMesg, __LINE__); - - return testFramework.countFails(); - } + Tests for the translate method + Given a baseString and a translation strings, the baseString will be "translated" + using those translation strings. + ========================================================================================================================= */ + int translateTest( void ) + { + TestUtil testFramework( "StringUtils", "strip", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString = "Hello World! I am the Translation test String!"; //Original String to replace characters on + string manipulatedString; //storage for manipulated base string + string translateFrom = "aeoWTS!"; //Characters to replace + string translateTo1 = "@30M7Q1"; //Characters that will replace the ones in translateFrom + string expectedResult1 = "H3ll0 M0rld1 I @m th3 7r@nsl@ti0n t3st Qtring1"; //Correctly translated base string with translateTo1 + string translateTo2 = "@30M7"; //Characters that will replace the ones in translateFrom + string expectedResult2 = "H3ll0 M0rld I @m th3 7r@nsl@ti0n t3st tring "; //Correctly translated base string with translateTo2 + string translateTo3 = "aeoWTS!"; //Characters that will replace the ones in translateFrom + string expectedResult3 = "Hello World! I am the Translation test String!"; //Correctly translated base string with translateTo3 + + manipulatedString = translate(baseString, translateFrom, translateTo1); + failMesg = "Verify that translate works by changing multiple characters"; + testFramework.assert(manipulatedString == expectedResult1, failMesg, __LINE__); + + manipulatedString = translate(baseString, translateFrom, translateTo2); + failMesg = "Verify that translate replaces unmatched characters with blanks"; + testFramework.assert(manipulatedString == expectedResult2, failMesg, __LINE__); + + manipulatedString = translate(baseString, translateFrom, translateTo3); + failMesg = "Verify that translate won't change things when supplied the same set of characters"; + testFramework.assert(manipulatedString == expectedResult3, failMesg, __LINE__); + + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the string to number methods - Given a baseString and a target number type, the methods should - generate the appropriate values. -========================================================================================================================= */ - int stringToNumberTest( void ) - { - TestUtil testFramework( "StringUtils", "asInt", __FILE__, __LINE__ ); - std::string failMesg; - - string baseString = "12345.67890"; //String to convert to a number - int resultingInt, comparisonInt = 12345; //Storage for converted string and the expected result value - double resultingDouble, comparisonDouble = 12345.67890; //Storage for converted string and the expected result value - float resultingFloat, comparisonFloat = 12345.67890f; //Storage for converted string and the expected result value - long double resultingLongDouble, comparisonLongDouble = 12345.67890L; //Storage for converted string and the expected result value - - resultingInt = asInt(baseString); - failMesg = "Verify that asInt works as intended"; - testFramework.assert(resultingInt == comparisonInt, failMesg, __LINE__); - - testFramework.changeSourceMethod("asDouble"); - resultingDouble = asDouble(baseString); - failMesg = "Verify that asDouble works as intended"; - testFramework.assert(resultingDouble == comparisonDouble, failMesg, __LINE__); - - testFramework.changeSourceMethod("asFloat"); - resultingFloat = asFloat(baseString); - failMesg = "Verify that asFloat works as intended"; - testFramework.assert(resultingFloat == comparisonFloat, failMesg, __LINE__); - - testFramework.changeSourceMethod("asLongDouble"); - resultingLongDouble = asLongDouble(baseString); - failMesg = "Verify that asLongDouble works as intended"; - testFramework.assert(resultingLongDouble == comparisonLongDouble, failMesg, __LINE__); - - return testFramework.countFails(); - } + Tests for the string to number methods + Given a baseString and a target number type, the methods should + generate the appropriate values. + ========================================================================================================================= */ + int stringToNumberTest( void ) + { + TestUtil testFramework( "StringUtils", "asInt", __FILE__, __LINE__ ); + std::string failMesg; + + string baseString = "12345.67890"; //String to convert to a number + int resultingInt, comparisonInt = 12345; //Storage for converted string and the expected result value + double resultingDouble, comparisonDouble = 12345.67890; //Storage for converted string and the expected result value + float resultingFloat, comparisonFloat = 12345.67890f; //Storage for converted string and the expected result value + long double resultingLongDouble, comparisonLongDouble = 12345.67890L; //Storage for converted string and the expected result value + + resultingInt = asInt(baseString); + failMesg = "Verify that asInt works as intended"; + testFramework.assert(resultingInt == comparisonInt, failMesg, __LINE__); + + testFramework.changeSourceMethod("asDouble"); + resultingDouble = asDouble(baseString); + failMesg = "Verify that asDouble works as intended"; + testFramework.assert(resultingDouble == comparisonDouble, failMesg, __LINE__); + + testFramework.changeSourceMethod("asFloat"); + resultingFloat = asFloat(baseString); + failMesg = "Verify that asFloat works as intended"; + testFramework.assert(resultingFloat == comparisonFloat, failMesg, __LINE__); + + testFramework.changeSourceMethod("asLongDouble"); + resultingLongDouble = asLongDouble(baseString); + failMesg = "Verify that asLongDouble works as intended"; + testFramework.assert(resultingLongDouble == comparisonLongDouble, failMesg, __LINE__); + + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the number to string method - Given numbers of various types, convert them to a string and - compare against the correct known value. - - Note that in the previous test the string to number methods are tested. - It is okay to use them here as any failures here may be cross-referenced with the results - of the previous test. -========================================================================================================================= */ - int numberToStringTest( void ) - { - TestUtil testFramework( "StringUtils", "asString", __FILE__, __LINE__ ); - std::string failMesg; - - string convertedString; //Storage for converted number - int sampleInt = 1234567890; //Example integer to test - double sampleDouble = 12345.67890; //Example double to test - float sampleFloat = 12345.7f; //Example float to test - long double sampleLongDouble = 12345.67890L;//Example long double to test + Tests for the number to string method + Given numbers of various types, convert them to a string and + compare against the correct known value. + + Note that in the previous test the string to number methods are tested. + It is okay to use them here as any failures here may be cross-referenced with the results + of the previous test. + ========================================================================================================================= */ + int numberToStringTest( void ) + { + TestUtil testFramework( "StringUtils", "asString", __FILE__, __LINE__ ); + std::string failMesg; + + string convertedString; //Storage for converted number + int sampleInt = 1234567890; //Example integer to test + double sampleDouble = 12345.67890; //Example double to test + float sampleFloat = 12345.7f; //Example float to test + long double sampleLongDouble = 12345.67890L;//Example long double to test - convertedString = asString(sampleInt); - failMesg = "Verify that asString converts ints"; - testFramework.assert(asInt(convertedString) == sampleInt, failMesg, __LINE__); + convertedString = asString(sampleInt); + failMesg = "Verify that asString converts ints"; + testFramework.assert(asInt(convertedString) == sampleInt, failMesg, __LINE__); - convertedString = asString(sampleDouble); - failMesg = "Verify that asString converts doubles"; - testFramework.assert(asDouble(convertedString) == sampleDouble, failMesg, __LINE__); + convertedString = asString(sampleDouble); + failMesg = "Verify that asString converts doubles"; + testFramework.assert(asDouble(convertedString) == sampleDouble, failMesg, __LINE__); - convertedString = asString(sampleFloat); - failMesg = "Verify that asString converts floats"; - testFramework.assert(asFloat(convertedString) == sampleFloat, failMesg, __LINE__); + convertedString = asString(sampleFloat); + failMesg = "Verify that asString converts floats"; + testFramework.assert(asFloat(convertedString) == sampleFloat, failMesg, __LINE__); - convertedString = asString(sampleLongDouble); - failMesg = "Verify that asString converts long doubles"; - testFramework.assert(asLongDouble(convertedString) == sampleLongDouble, failMesg, __LINE__); + convertedString = asString(sampleLongDouble); + failMesg = "Verify that asString converts long doubles"; + testFramework.assert(asLongDouble(convertedString) == sampleLongDouble, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the hex converters - - Given strings with hex and decimal values, convert the values to the opposite type - then compare with expected results -========================================================================================================================= */ - int hexConversionTest( void ) - { - TestUtil testFramework( "StringUtils", "x2d", __FILE__, __LINE__ ); - std::string failMesg; - - string initialHexString = "0x100 foo"; //Example string with hex values in it - string correctConvertedHexString = "256 foo"; //Resulting string when the hex -> decimal conversion was made - string initialDecimalString ="100 bar"; //Example decimal string - string correctConvertedDecimalString = "64 bar"; //Resulting string when the decimal -> hex conversion was made - string manipulatedResult; //Storage for manipulated strings - - manipulatedResult = x2d(initialHexString); - failMesg = "Verify that x2d works"; - testFramework.assert(initialHexString == correctConvertedHexString, failMesg, __LINE__); - - testFramework.changeSourceMethod("d2x"); - manipulatedResult = d2x(initialDecimalString); - failMesg = "Verify that d2x works"; - testFramework.assert(initialDecimalString == correctConvertedDecimalString, failMesg, __LINE__); - - return testFramework.countFails(); - } + Tests for the hex converters + + Given strings with hex and decimal values, convert the values to the opposite type + then compare with expected results + ========================================================================================================================= */ + int hexConversionTest( void ) + { + TestUtil testFramework( "StringUtils", "x2d", __FILE__, __LINE__ ); + std::string failMesg; + + string initialHexString = "0x100 foo"; //Example string with hex values in it + string correctConvertedHexString = "256 foo"; //Resulting string when the hex -> decimal conversion was made + string initialDecimalString ="100 bar"; //Example decimal string + string correctConvertedDecimalString = "64 bar"; //Resulting string when the decimal -> hex conversion was made + string manipulatedResult; //Storage for manipulated strings + + manipulatedResult = x2d(initialHexString); + failMesg = "Verify that x2d works"; + testFramework.assert(initialHexString == correctConvertedHexString, failMesg, __LINE__); + + testFramework.changeSourceMethod("d2x"); + manipulatedResult = d2x(initialDecimalString); + failMesg = "Verify that d2x works"; + testFramework.assert(initialDecimalString == correctConvertedDecimalString, failMesg, __LINE__); + + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the string replace methods + Tests for the string replace methods - Provided a string, replace substrings within it with other substrings and compare with expected results. + Provided a string, replace substrings within it with other substrings and compare with expected results. - WARNING: Method will perform the replace on the string passed to it as well! -========================================================================================================================= */ - int stringReplaceTest( void ) - { - TestUtil testFramework( "StringUtils", "replaceAll", __FILE__, __LINE__ ); - std::string failMesg; + WARNING: Method will perform the replace on the string passed to it as well! + ========================================================================================================================= */ + int stringReplaceTest( void ) + { + TestUtil testFramework( "StringUtils", "replaceAll", __FILE__, __LINE__ ); + std::string failMesg; - string baseString = "010101000111010"; - string replaced1s = "0-0-0-000---0-0"; - string replaced1withABC = "0ABC0ABC0ABC000ABCABCABC0ABC0"; - string replaced1with123 = "01230123012300012312312301230"; - string manipulatedString; + string baseString = "010101000111010"; + string replaced1s = "0-0-0-000---0-0"; + string replaced1withABC = "0ABC0ABC0ABC000ABCABCABC0ABC0"; + string replaced1with123 = "01230123012300012312312301230"; + string manipulatedString; - manipulatedString = baseString; - manipulatedString = replaceAll(manipulatedString, string("1"), string("-")); - failMesg = "Verify that replaceAll works with a character swap"; - testFramework.assert(manipulatedString == replaced1s, failMesg, __LINE__); + manipulatedString = baseString; + manipulatedString = replaceAll(manipulatedString, string("1"), string("-")); + failMesg = "Verify that replaceAll works with a character swap"; + testFramework.assert(manipulatedString == replaced1s, failMesg, __LINE__); - manipulatedString = baseString; - manipulatedString = replaceAll(manipulatedString, string("1"), string("ABC")); - failMesg = "Verify that replaceAll works with a character swap"; - testFramework.assert(manipulatedString == replaced1withABC, failMesg, __LINE__); + manipulatedString = baseString; + manipulatedString = replaceAll(manipulatedString, string("1"), string("ABC")); + failMesg = "Verify that replaceAll works with a character swap"; + testFramework.assert(manipulatedString == replaced1withABC, failMesg, __LINE__); - manipulatedString = baseString; - manipulatedString = replaceAll(manipulatedString, string("1"), string("123")); - failMesg = "Verify that replaceAll works with a character swap"; - testFramework.assert(manipulatedString == replaced1with123, failMesg, __LINE__); + manipulatedString = baseString; + manipulatedString = replaceAll(manipulatedString, string("1"), string("123")); + failMesg = "Verify that replaceAll works with a character swap"; + testFramework.assert(manipulatedString == replaced1with123, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the word methods - - WARNING: Removal methods will perform the replace on the string passed to it as well! -========================================================================================================================= */ - int wordTest( void ) - { - TestUtil testFramework( "StringUtils", "firstWord", __FILE__, __LINE__ ); - std::string failMesg; - - - string originalString = " The Quick Brown Fox Jumps Over The Lazy Dog. "; //Original string to manipulate - string firstWordInString = "The"; //Expected result for use of firstWord with the original string - int numberOfWords = 9; //Number of words in the original string - int resultInt; - string fifthWordInString = "Jumps"; //Expected result for the fifth word in the original string - string removedFourthFifthWords = " The Quick Brown Over The Lazy Dog. "; //Expected result for removal of the 4th and 5th words - string removedFirstWord = "Quick Brown Over The Lazy Dog. "; //Expected result for the removal of the 1st word in removedFourthFifthWords - string removedSixthWord = "Quick Brown Over The Lazy"; //Expected result of the removal of the sixth word in removedFirstWord - string allWordsFromFourthOn = "The Lazy"; //Expected result of the reporting of the words from the fourth to the end of removedSixthWord - string resultString; //String to store resulting data. - - - resultString = firstWord(originalString); - failMesg = "Verify that firstWord returns the correct word in the string"; - testFramework.assert(resultString == firstWordInString, failMesg, __LINE__); + Tests for the word methods + + WARNING: Removal methods will perform the replace on the string passed to it as well! + ========================================================================================================================= */ + int wordTest( void ) + { + TestUtil testFramework( "StringUtils", "firstWord", __FILE__, __LINE__ ); + std::string failMesg; + + + string originalString = " The Quick Brown Fox Jumps Over The Lazy Dog. "; //Original string to manipulate + string firstWordInString = "The"; //Expected result for use of firstWord with the original string + int numberOfWords = 9; //Number of words in the original string + int resultInt; + string fifthWordInString = "Jumps"; //Expected result for the fifth word in the original string + string removedFourthFifthWords = " The Quick Brown Over The Lazy Dog. "; //Expected result for removal of the 4th and 5th words + string removedFirstWord = "Quick Brown Over The Lazy Dog. "; //Expected result for the removal of the 1st word in removedFourthFifthWords + string removedSixthWord = "Quick Brown Over The Lazy"; //Expected result of the removal of the sixth word in removedFirstWord + string allWordsFromFourthOn = "The Lazy"; //Expected result of the reporting of the words from the fourth to the end of removedSixthWord + string resultString; //String to store resulting data. + + + resultString = firstWord(originalString); + failMesg = "Verify that firstWord returns the correct word in the string"; + testFramework.assert(resultString == firstWordInString, failMesg, __LINE__); - testFramework.changeSourceMethod("numWords"); - resultInt = numWords(originalString); - failMesg = "Verify that firstWord returns the correct word in the string"; - testFramework.assert(resultInt == numberOfWords, failMesg, __LINE__); + testFramework.changeSourceMethod("numWords"); + resultInt = numWords(originalString); + failMesg = "Verify that firstWord returns the correct word in the string"; + testFramework.assert(resultInt == numberOfWords, failMesg, __LINE__); - testFramework.changeSourceMethod("word"); - resultString = word(originalString,4); - failMesg = "Verify that word returns the correct word in the string (words are ordered starting with 0)"; - testFramework.assert(resultString == fifthWordInString, failMesg, __LINE__); + testFramework.changeSourceMethod("word"); + resultString = word(originalString,4); + failMesg = "Verify that word returns the correct word in the string (words are ordered starting with 0)"; + testFramework.assert(resultString == fifthWordInString, failMesg, __LINE__); - testFramework.changeSourceMethod("removeWords"); - resultString = removeWords(originalString, 3, 2); //This changes the string passed to the method - failMesg = "Verify that removeWords removes the correct set of words"; - testFramework.assert(resultString == removedFourthFifthWords, failMesg, __LINE__); + testFramework.changeSourceMethod("removeWords"); + resultString = removeWords(originalString, 3, 2); //This changes the string passed to the method + failMesg = "Verify that removeWords removes the correct set of words"; + testFramework.assert(resultString == removedFourthFifthWords, failMesg, __LINE__); - testFramework.changeSourceMethod("stripFirstWord"); - resultString = stripFirstWord(originalString); //This changes the string passed to the method - failMesg = "Verify that the first word is stripped from the string"; - testFramework.assert(originalString == removedFirstWord, failMesg, __LINE__); + testFramework.changeSourceMethod("stripFirstWord"); + resultString = stripFirstWord(originalString); //This changes the string passed to the method + failMesg = "Verify that the first word is stripped from the string"; + testFramework.assert(originalString == removedFirstWord, failMesg, __LINE__); - testFramework.changeSourceMethod("removeWords"); - resultString = removeWords(originalString,5); //This changes the string passed to the method - failMesg = "Verify that removeWords removes the proper word from the string"; - testFramework.assert(resultString == removedSixthWord, failMesg, __LINE__); + testFramework.changeSourceMethod("removeWords"); + resultString = removeWords(originalString,5); //This changes the string passed to the method + failMesg = "Verify that removeWords removes the proper word from the string"; + testFramework.assert(resultString == removedSixthWord, failMesg, __LINE__); - testFramework.changeSourceMethod("words"); - resultString = words(originalString,3); - failMesg = "Verify that words returns all words from the correct position (4th in this case) onward"; - testFramework.assert(resultString == allWordsFromFourthOn, failMesg, __LINE__); + testFramework.changeSourceMethod("words"); + resultString = words(originalString,3); + failMesg = "Verify that words returns all words from the correct position (4th in this case) onward"; + testFramework.assert(resultString == allWordsFromFourthOn, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Tests for the regular expression methods - - Provided a string and a regular expression query, the isLike method will return 0 or 1 if a match is found. - Matches will then provide the found result. -========================================================================================================================= */ - int regularExpressionsTest( void ) - { - TestUtil testFramework( "StringUtils", "isLike", __FILE__, __LINE__ ); - std::string failMesg; - - string originalString = " The Quick Brown Fox Jumps Over The Lazy Dog. "; //String to be searched - int resultInt; //Storage for isLike result - string testedRegularExpression1 = "Br.*Over.*"; //A query which will be found - string testedRegularExpression2 = "Br.Over.*"; //A query which will not be found - string resultString; //Storage for matches method - string correctResult = "Brown Fox Jumps Over The Lazy Dog. "; //Expected string to be found - - - resultInt = isLike(originalString, testedRegularExpression1); - failMesg = "Verify that isLike returns 1 when the expression is found in the given string"; - testFramework.assert(resultInt == 1, failMesg, __LINE__); + Tests for the regular expression methods + + Provided a string and a regular expression query, the isLike method will return 0 or 1 if a match is found. + Matches will then provide the found result. + ========================================================================================================================= */ + int regularExpressionsTest( void ) + { + TestUtil testFramework( "StringUtils", "isLike", __FILE__, __LINE__ ); + std::string failMesg; + + string originalString = " The Quick Brown Fox Jumps Over The Lazy Dog. "; //String to be searched + int resultInt; //Storage for isLike result + string testedRegularExpression1 = "Br.*Over.*"; //A query which will be found + string testedRegularExpression2 = "Br.Over.*"; //A query which will not be found + string resultString; //Storage for matches method + string correctResult = "Brown Fox Jumps Over The Lazy Dog. "; //Expected string to be found + + + resultInt = isLike(originalString, testedRegularExpression1); + failMesg = "Verify that isLike returns 1 when the expression is found in the given string"; + testFramework.assert(resultInt == 1, failMesg, __LINE__); - resultInt = isLike(originalString, testedRegularExpression2); - failMesg = "Verify that isLike returns 0 when the expression is NOT found in the given string"; - testFramework.assert(resultInt == 0, failMesg, __LINE__); + resultInt = isLike(originalString, testedRegularExpression2); + failMesg = "Verify that isLike returns 0 when the expression is NOT found in the given string"; + testFramework.assert(resultInt == 0, failMesg, __LINE__); - testFramework.changeSourceMethod("matches"); - resultString = matches(originalString, testedRegularExpression1); - failMesg = "Verify that matches returns the string which matches the regular expression given"; - testFramework.assert(resultString == correctResult, failMesg, __LINE__); + testFramework.changeSourceMethod("matches"); + resultString = matches(originalString, testedRegularExpression1); + failMesg = "Verify that matches returns the string which matches the regular expression given"; + testFramework.assert(resultString == correctResult, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Test for the prettyPrint method + Test for the prettyPrint method - prettyPrint will take a string and split the information into formatted lines -========================================================================================================================= */ - int prettyPrintTest( void ) - { - TestUtil testFramework( "StringUtils", "prettyPrint", __FILE__, __LINE__ ); - std::string failMesg; - string originalString("This is a very long sentence that will get cut up into lines with a maximum length of 40 characters, each line indented by a few spaces."); - string prettyPrintThis = originalString; - string prettyPrinted = " This is a very long sentence that\n will get cut up into lines with a\n maximum length of 40 characters,\n each line indented by a few spaces.\n"; + prettyPrint will take a string and split the information into formatted lines + ========================================================================================================================= */ + int prettyPrintTest( void ) + { + TestUtil testFramework( "StringUtils", "prettyPrint", __FILE__, __LINE__ ); + std::string failMesg; + string originalString("This is a very long sentence that will get cut up into lines with a maximum length of 40 characters, each line indented by a few spaces."); + string prettyPrintThis = originalString; + string prettyPrinted = " This is a very long sentence that\n will get cut up into lines with a\n maximum length of 40 characters,\n each line indented by a few spaces.\n"; - prettyPrint(prettyPrintThis, "\n", " ", " ", 40); - failMesg = "Verify that prettyPrint works"; - testFramework.assert(prettyPrinted == prettyPrintThis, failMesg, __LINE__); + prettyPrint(prettyPrintThis, "\n", " ", " ", 40); + failMesg = "Verify that prettyPrint works"; + testFramework.assert(prettyPrinted == prettyPrintThis, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } /* ========================================================================================================================= - Test for the splitOnWhitespace method - - splitOnWhitespace will split a string into a std::vector respecting single and double quoted strings -========================================================================================================================= */ - int splitOnWhitespaceTest( void ) - { - TestUtil testFramework( "StringUtils", "splitOnWhitespace", __FILE__, __LINE__ ); - std::string failMesg; - - // no quotes - std::string originalString("String with no quotes"); - std::vector expectedResult; - expectedResult.push_back("String"); - expectedResult.push_back("with"); - expectedResult.push_back("no"); - expectedResult.push_back("quotes"); - std::vector observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with no quotes"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // empty string - originalString = ""; - expectedResult.clear(); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with empty string"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // only whitespace - originalString = " "; - expectedResult.clear(); - expectedResult.push_back(" "); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with just whitespace"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // double quotes - originalString = std::string("String with \"double quoted values\""); - expectedResult.clear(); - observedResult.clear(); - expectedResult.push_back("String"); - expectedResult.push_back("with"); - expectedResult.push_back("\"double quoted values\""); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with double quotes"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // single quotes - originalString= std::string("String with \'single quoted values\'"); - expectedResult.clear(); - observedResult.clear(); - expectedResult.push_back("String"); - expectedResult.push_back("with"); - expectedResult.push_back("\'single quoted values\'"); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with double quotes"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // leading quote - originalString= std::string("\"First words\" quoted"); - expectedResult.clear(); - observedResult.clear(); - expectedResult.push_back("\"First words\""); - expectedResult.push_back("quoted"); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with leading quote"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - // back to back quotes - originalString= std::string("\"Back to\" \"back quotes\""); - expectedResult.clear(); - observedResult.clear(); - expectedResult.push_back("\"Back to\""); - expectedResult.push_back("\"back quotes\""); - observedResult = splitOnWhitespace(originalString); - - failMesg = "Verify splitOnWhitespace works with leading quote"; - testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); - - return testFramework.countFails(); - } + Test for the splitWithQuotes method + + splitWithQuotes will split a string into a std::vector respecting single and double quoted strings + ========================================================================================================================= */ + int splitWithQuotesTest( void ) + { + TestUtil testFramework( "StringUtils", "splitWithQuotes", __FILE__, __LINE__ ); + std::string failMesg; + + // no quotes + std::string originalString("String with no quotes"); + std::vector expectedResult; + expectedResult.push_back("String"); + expectedResult.push_back("with"); + expectedResult.push_back("no"); + expectedResult.push_back("quotes"); + std::vector observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes fails with no quotes"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // empty string + originalString = ""; + expectedResult.clear(); + observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes fails with empty string"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // only whitespace + originalString = " "; + expectedResult.clear(); + expectedResult.push_back(""); + expectedResult.push_back(""); + observedResult = splitWithQuotes(originalString,' ',false,false); + + failMesg = "splitWithQuotes fails with just whitespace"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // double quotes + originalString = std::string("String with \"double quoted values\""); + expectedResult.clear(); + expectedResult.push_back("String"); + expectedResult.push_back("with"); + expectedResult.push_back("double quoted values"); + observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes fails with double quotes"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // single quotes + originalString= std::string("String with \'single quoted values\'"); + expectedResult.clear(); + expectedResult.push_back("String"); + expectedResult.push_back("with"); + expectedResult.push_back("single quoted values"); + observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes fails with double quotes"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // leading quote + originalString= std::string("\"First words\" quoted"); + expectedResult.clear(); + expectedResult.push_back("First words"); + expectedResult.push_back("quoted"); + observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes fails with leading quote"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // back to back quotes + originalString= std::string("\"Back to\" \"back quotes\""); + expectedResult.clear(); + expectedResult.push_back("Back to"); + expectedResult.push_back("back quotes"); + observedResult = splitWithQuotes(originalString); + + failMesg = "splitWithQuotes failed with leading quote"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + // empty, non-whitespace fields + originalString = + std::string("Zan.35(KB04-KB01), +90 7 7.73619,,,,-1.52405,no,,,"); + expectedResult.clear(); + expectedResult.push_back("Zan.35(KB04-KB01)"); + expectedResult.push_back("+90 7 7.73619"); + expectedResult.push_back(""); + expectedResult.push_back(""); + expectedResult.push_back(""); + expectedResult.push_back("-1.52405"); + expectedResult.push_back("no"); + expectedResult.push_back(""); + expectedResult.push_back(""); + expectedResult.push_back(""); + observedResult = splitWithQuotes(originalString,',',true,false); + + failMesg = "splitWithQuotes fails with empty non-white fields"; + testFramework.assert(expectedResult == observedResult, failMesg, __LINE__); + + + return testFramework.countFails(); + } /* ========================================================================================================================= - Test for the hexDump methods - - This test is intended to verify that the unique ASCII characters - are all transformed from hex and output properly. - - The hexDataDump method is to display hex data in ASCII format. This output may be configured using - the configHexDataDump method, or output without the comparison hex code using the printable method. - - THIS TEST SHOULD BE REMADE TO BE CROSS PLATFORM -========================================================================================================================= */ - int hexToAsciiTest( void ) - { - TestUtil testFramework( "StringUtils", "hexDumpData", __FILE__, __LINE__ ); - std::string failMesg; - - - stringstream hexDumpStream; - stringstream correctHexDumpStream; - stringstream configHexDumpStream; - stringstream correctConfigHexDumpStream; - stringstream correctPrintableMessage; - stringstream printableMessageStream; - - char hexDumpArray[] = //Array of hex values to output - { 0x00, 0x10, 0x30, 0x33, 0x30, 0x31, 0x30, 0x35, - 0x3A, 0x65, 0x70, 0x68, 0x20, 0x3A, 0x30, 0x3A, - 0x35, 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, - 0x33, 0x34, 0x30, 0x32, 0x37, 0x37, 0x37, 0x37, - 0x37, 0x37, 0x37, 0x38, 0x41, 0x20, 0x52, 0x61, - 0x6e, 0x64, 0x6F, 0x6D, 0x20, 0x4D, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x39, 0x32, - 0x35, 0x39, 0x32, 0x34, 0x20, 0x32, 0x20, 0x35, - 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, 0x38, - 0x38, 0x33, 0x36, 0x33, 0x34, 0x32, 0x35, 0x39, - 0x32, 0x35, 0x39, 0x33, 0x20, 0x32, 0x20, 0x38, - 0x35, 0x34, 0x31, 0x32, 0x20, 0x31, 0x20, 0x31, - 0x20, 0x30, 0x20, 0x31, 0x20, 0x31, 0x20, 0x34, - 0x20, 0x32, 0x20, 0x34, 0x20, 0x30, 0x20, 0x30, - 0x20, 0x33, 0x20, 0x31, 0x31, 0x39, 0x39, 0x20, - 0x32, 0x32, 0x63, 0x30, 0x61, 0x66, 0x30, 0x33, - 0x20, 0x31, 0x37, 0x37, 0x30, 0x32, 0x39, 0x65, - 0x34, 0x20, 0x61, 0x66, 0x34, 0x30, 0x30, 0x31, - 0x66, 0x20, 0x65, 0x36, 0x31, 0x62, 0x35, 0x38, - 0x61, 0x20, 0x35, 0x35, 0x66, 0x33, 0x37, 0x35, - 0x30, 0x20, 0x34, 0x63, 0x63, 0x61, 0x38, 0x38, - 0x37, 0x20, 0x31, 0x31, 0x35, 0x64, 0x37, 0x63, - 0x66, 0x63, 0x20, 0x33, 0x61, 0x64, 0x32, 0x30, - 0x34, 0x38, 0x61, 0x20, 0x63, 0x65, 0x61, 0x20, - 0x33, 0x36, 0x32, 0x63, 0x34, 0x38, 0x20, 0x31, - 0x31, 0x39, 0x39, 0x20, 0x32, 0x32, 0x63, 0x30, - 0x61, 0x66, 0x30, 0x33, 0x20, 0x31, 0x37, 0x37, - 0x30, 0x34, 0x61, 0x37, 0x34, 0x20, 0x33, 0x61, - 0x63, 0x34, 0x36, 0x36, 0x63, 0x31, 0x20, 0x62, - 0x64, 0x30, 0x63, 0x36, 0x64, 0x63, 0x20, 0x33, - 0x39, 0x31, 0x62, 0x33, 0x37, 0x38, 0x33, 0x20, - 0x33, 0x65, 0x30, 0x34, 0x30, 0x63, 0x66, 0x85 }; - - //Correct format for hexDumpData, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) - //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER - //OPERATING SYSTEMS OR COMPILERS. - correctHexDumpStream << "0000: 00 10 30 33 30 31 30 35 3a 65 70 68 20 3a 30 3a ..030105:eph :0:" << endl - << "0010: 35 32 36 34 30 2e 33 33 33 34 30 32 37 37 37 37 52640.3334027777" << endl - << "0020: 37 37 37 38 41 20 52 61 6e 64 6f 6d 20 4d 65 73 7778A Random Mes" << endl - << "0030: 73 61 67 65 32 35 39 32 35 39 32 34 20 32 20 35 sage25925924 2 5" << endl - << "0040: 32 36 34 30 2e 33 33 38 38 33 36 33 34 32 35 39 2640.33883634259" << endl - << "0050: 32 35 39 33 20 32 20 38 35 34 31 32 20 31 20 31 2593 2 85412 1 1" << endl - << "0060: 20 30 20 31 20 31 20 34 20 32 20 34 20 30 20 30 0 1 1 4 2 4 0 0" << endl - << "0070: 20 33 20 31 31 39 39 20 32 32 63 30 61 66 30 33 3 1199 22c0af03" << endl - << "0080: 20 31 37 37 30 32 39 65 34 20 61 66 34 30 30 31 177029e4 af4001" << endl - << "0090: 66 20 65 36 31 62 35 38 61 20 35 35 66 33 37 35 f e61b58a 55f375" << endl - << "00a0: 30 20 34 63 63 61 38 38 37 20 31 31 35 64 37 63 0 4cca887 115d7c" << endl - << "00b0: 66 63 20 33 61 64 32 30 34 38 61 20 63 65 61 20 fc 3ad2048a cea " << endl - << "00c0: 33 36 32 63 34 38 20 31 31 39 39 20 32 32 63 30 362c48 1199 22c0" << endl - << "00d0: 61 66 30 33 20 31 37 37 30 34 61 37 34 20 33 61 af03 17704a74 3a" << endl - << "00e0: 63 34 36 36 63 31 20 62 64 30 63 36 64 63 20 33 c466c1 bd0c6dc 3" << endl - << "00f0: 39 31 62 33 37 38 33 20 33 65 30 34 30 63 66 85 91b3783 3e040cf." << endl; - - //Correct format for the configured hexDumpData, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) - //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER - //OPERATING SYSTEMS OR COMPILERS. - correctConfigHexDumpStream << " 00000000: 0010 3033 3031 3035 3A65 7068 203A 303A '..030105:eph :0:'\n" - << " 00000010: 3532 3634 302E 3333 3334 3032 3737 3737 '52640.3334027777'\n" - << " 00000020: 3737 3738 4120 5261 6E64 6F6D 204D 6573 '7778A Random Mes'\n" - << " 00000030: 7361 6765 3235 3932 3539 3234 2032 2035 'sage25925924 2 5'\n" - << " 00000040: 3236 3430 2E33 3338 3833 3633 3432 3539 '2640.33883634259'\n" - << " 00000050: 3235 3933 2032 2038 3534 3132 2031 2031 '2593 2 85412 1 1'\n" - << " 00000060: 2030 2031 2031 2034 2032 2034 2030 2030 ' 0 1 1 4 2 4 0 0'\n" - << " 00000070: 2033 2031 3139 3920 3232 6330 6166 3033 ' 3 1199 22c0af03'\n" - << " 00000080: 2031 3737 3032 3965 3420 6166 3430 3031 ' 177029e4 af4001'\n" - << " 00000090: 6620 6536 3162 3538 6120 3535 6633 3735 'f e61b58a 55f375'\n" - << " 000000A0: 3020 3463 6361 3838 3720 3131 3564 3763 '0 4cca887 115d7c'\n" - << " 000000B0: 6663 2033 6164 3230 3438 6120 6365 6120 'fc 3ad2048a cea '\n" - << " 000000C0: 3336 3263 3438 2031 3139 3920 3232 6330 '362c48 1199 22c0'\n" - << " 000000D0: 6166 3033 2031 3737 3034 6137 3420 3361 'af03 17704a74 3a'\n" - << " 000000E0: 6334 3636 6331 2062 6430 6336 6463 2033 'c466c1 bd0c6dc 3'\n" - << " 000000F0: 3931 6233 3738 3320 3365 3034 3063 6685 '91b3783 3e040cf.'\n"; - - //Build the hexDumpString and output it to stringstream - string hexDumpString(hexDumpArray, sizeof(hexDumpArray)); - hexDumpData(hexDumpStream, hexDumpString); - - failMesg = "Verify that hexDumpData works"; - testFramework.assert(hexDumpStream.str() == correctHexDumpStream.str(), failMesg, __LINE__); - - //configure the hexDumpData, dump it to output stringstream - HexDumpDataConfig hdcfg(true, true, true, 8, 2, 2, 1, 0, 0, 16, true,'\'', 1); - hexDumpData(configHexDumpStream, hexDumpString, 6, hdcfg); - testFramework.changeSourceMethod("HexDumpDataConfig"); - - failMesg = "Verify that configuring the hexDumpData works"; - testFramework.assert(configHexDumpStream.str() == correctConfigHexDumpStream.str(), failMesg, __LINE__); - - //Correct format for the printable, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) - //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER - //OPERATING SYSTEMS OR COMPILERS. - correctPrintableMessage << "^@^P030105:eph :0:52640.33340277777778A Random Message25925924" - << " 2 52640.338836342592593 2 85412 1 1 0 1 1 4 2 4 0 0 3 1199 22c0af03" - << " 177029e4 af4001f e61b58a 55f3750 4cca887 115d7cfc 3ad2048a cea" - << " 362c48 1199 22c0af03 17704a74 3ac466c1 bd0c6dc 391b3783 3e040cf<85>"; - - printableMessageStream << printable(hexDumpString) ; - testFramework.changeSourceMethod("printable"); - failMesg = "Verify that prettyPrint works"; - testFramework.assert(printableMessageStream.str() == correctPrintableMessage.str(), failMesg, __LINE__); - - return testFramework.countFails(); - } + Test for the hexDump methods + + This test is intended to verify that the unique ASCII characters + are all transformed from hex and output properly. + + The hexDataDump method is to display hex data in ASCII format. This output may be configured using + the configHexDataDump method, or output without the comparison hex code using the printable method. + + THIS TEST SHOULD BE REMADE TO BE CROSS PLATFORM + ========================================================================================================================= */ + int hexToAsciiTest( void ) + { + TestUtil testFramework( "StringUtils", "hexDumpData", __FILE__, __LINE__ ); + std::string failMesg; + + + stringstream hexDumpStream; + stringstream correctHexDumpStream; + stringstream configHexDumpStream; + stringstream correctConfigHexDumpStream; + stringstream correctPrintableMessage; + stringstream printableMessageStream; + + char hexDumpArray[] = //Array of hex values to output + { 0x00, 0x10, 0x30, 0x33, 0x30, 0x31, 0x30, 0x35, + 0x3A, 0x65, 0x70, 0x68, 0x20, 0x3A, 0x30, 0x3A, + 0x35, 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, + 0x33, 0x34, 0x30, 0x32, 0x37, 0x37, 0x37, 0x37, + 0x37, 0x37, 0x37, 0x38, 0x41, 0x20, 0x52, 0x61, + 0x6e, 0x64, 0x6F, 0x6D, 0x20, 0x4D, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x39, 0x32, + 0x35, 0x39, 0x32, 0x34, 0x20, 0x32, 0x20, 0x35, + 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, 0x38, + 0x38, 0x33, 0x36, 0x33, 0x34, 0x32, 0x35, 0x39, + 0x32, 0x35, 0x39, 0x33, 0x20, 0x32, 0x20, 0x38, + 0x35, 0x34, 0x31, 0x32, 0x20, 0x31, 0x20, 0x31, + 0x20, 0x30, 0x20, 0x31, 0x20, 0x31, 0x20, 0x34, + 0x20, 0x32, 0x20, 0x34, 0x20, 0x30, 0x20, 0x30, + 0x20, 0x33, 0x20, 0x31, 0x31, 0x39, 0x39, 0x20, + 0x32, 0x32, 0x63, 0x30, 0x61, 0x66, 0x30, 0x33, + 0x20, 0x31, 0x37, 0x37, 0x30, 0x32, 0x39, 0x65, + 0x34, 0x20, 0x61, 0x66, 0x34, 0x30, 0x30, 0x31, + 0x66, 0x20, 0x65, 0x36, 0x31, 0x62, 0x35, 0x38, + 0x61, 0x20, 0x35, 0x35, 0x66, 0x33, 0x37, 0x35, + 0x30, 0x20, 0x34, 0x63, 0x63, 0x61, 0x38, 0x38, + 0x37, 0x20, 0x31, 0x31, 0x35, 0x64, 0x37, 0x63, + 0x66, 0x63, 0x20, 0x33, 0x61, 0x64, 0x32, 0x30, + 0x34, 0x38, 0x61, 0x20, 0x63, 0x65, 0x61, 0x20, + 0x33, 0x36, 0x32, 0x63, 0x34, 0x38, 0x20, 0x31, + 0x31, 0x39, 0x39, 0x20, 0x32, 0x32, 0x63, 0x30, + 0x61, 0x66, 0x30, 0x33, 0x20, 0x31, 0x37, 0x37, + 0x30, 0x34, 0x61, 0x37, 0x34, 0x20, 0x33, 0x61, + 0x63, 0x34, 0x36, 0x36, 0x63, 0x31, 0x20, 0x62, + 0x64, 0x30, 0x63, 0x36, 0x64, 0x63, 0x20, 0x33, + 0x39, 0x31, 0x62, 0x33, 0x37, 0x38, 0x33, 0x20, + 0x33, 0x65, 0x30, 0x34, 0x30, 0x63, 0x66, '\205' }; + + //Correct format for hexDumpData, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) + //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER + //OPERATING SYSTEMS OR COMPILERS. + correctHexDumpStream << "0000: 00 10 30 33 30 31 30 35 3a 65 70 68 20 3a 30 3a ..030105:eph :0:" << endl + << "0010: 35 32 36 34 30 2e 33 33 33 34 30 32 37 37 37 37 52640.3334027777" << endl + << "0020: 37 37 37 38 41 20 52 61 6e 64 6f 6d 20 4d 65 73 7778A Random Mes" << endl + << "0030: 73 61 67 65 32 35 39 32 35 39 32 34 20 32 20 35 sage25925924 2 5" << endl + << "0040: 32 36 34 30 2e 33 33 38 38 33 36 33 34 32 35 39 2640.33883634259" << endl + << "0050: 32 35 39 33 20 32 20 38 35 34 31 32 20 31 20 31 2593 2 85412 1 1" << endl + << "0060: 20 30 20 31 20 31 20 34 20 32 20 34 20 30 20 30 0 1 1 4 2 4 0 0" << endl + << "0070: 20 33 20 31 31 39 39 20 32 32 63 30 61 66 30 33 3 1199 22c0af03" << endl + << "0080: 20 31 37 37 30 32 39 65 34 20 61 66 34 30 30 31 177029e4 af4001" << endl + << "0090: 66 20 65 36 31 62 35 38 61 20 35 35 66 33 37 35 f e61b58a 55f375" << endl + << "00a0: 30 20 34 63 63 61 38 38 37 20 31 31 35 64 37 63 0 4cca887 115d7c" << endl + << "00b0: 66 63 20 33 61 64 32 30 34 38 61 20 63 65 61 20 fc 3ad2048a cea " << endl + << "00c0: 33 36 32 63 34 38 20 31 31 39 39 20 32 32 63 30 362c48 1199 22c0" << endl + << "00d0: 61 66 30 33 20 31 37 37 30 34 61 37 34 20 33 61 af03 17704a74 3a" << endl + << "00e0: 63 34 36 36 63 31 20 62 64 30 63 36 64 63 20 33 c466c1 bd0c6dc 3" << endl + << "00f0: 39 31 62 33 37 38 33 20 33 65 30 34 30 63 66 85 91b3783 3e040cf." << endl; + + //Correct format for the configured hexDumpData, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) + //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER + //OPERATING SYSTEMS OR COMPILERS. + correctConfigHexDumpStream << " 00000000: 0010 3033 3031 3035 3A65 7068 203A 303A '..030105:eph :0:'\n" + << " 00000010: 3532 3634 302E 3333 3334 3032 3737 3737 '52640.3334027777'\n" + << " 00000020: 3737 3738 4120 5261 6E64 6F6D 204D 6573 '7778A Random Mes'\n" + << " 00000030: 7361 6765 3235 3932 3539 3234 2032 2035 'sage25925924 2 5'\n" + << " 00000040: 3236 3430 2E33 3338 3833 3633 3432 3539 '2640.33883634259'\n" + << " 00000050: 3235 3933 2032 2038 3534 3132 2031 2031 '2593 2 85412 1 1'\n" + << " 00000060: 2030 2031 2031 2034 2032 2034 2030 2030 ' 0 1 1 4 2 4 0 0'\n" + << " 00000070: 2033 2031 3139 3920 3232 6330 6166 3033 ' 3 1199 22c0af03'\n" + << " 00000080: 2031 3737 3032 3965 3420 6166 3430 3031 ' 177029e4 af4001'\n" + << " 00000090: 6620 6536 3162 3538 6120 3535 6633 3735 'f e61b58a 55f375'\n" + << " 000000A0: 3020 3463 6361 3838 3720 3131 3564 3763 '0 4cca887 115d7c'\n" + << " 000000B0: 6663 2033 6164 3230 3438 6120 6365 6120 'fc 3ad2048a cea '\n" + << " 000000C0: 3336 3263 3438 2031 3139 3920 3232 6330 '362c48 1199 22c0'\n" + << " 000000D0: 6166 3033 2031 3737 3034 6137 3420 3361 'af03 17704a74 3a'\n" + << " 000000E0: 6334 3636 6331 2062 6430 6336 6463 2033 'c466c1 bd0c6dc 3'\n" + << " 000000F0: 3931 6233 3738 3320 3365 3034 3063 6685 '91b3783 3e040cf.'\n"; + + //Build the hexDumpString and output it to stringstream + string hexDumpString(hexDumpArray, sizeof(hexDumpArray)); + hexDumpData(hexDumpStream, hexDumpString); + + failMesg = "Verify that hexDumpData works"; + testFramework.assert(hexDumpStream.str() == correctHexDumpStream.str(), failMesg, __LINE__); + + //configure the hexDumpData, dump it to output stringstream + HexDumpDataConfig hdcfg(true, true, true, 8, 2, 2, 1, 0, 0, 16, true,'\'', 1); + hexDumpData(configHexDumpStream, hexDumpString, 6, hdcfg); + testFramework.changeSourceMethod("HexDumpDataConfig"); + + failMesg = "Verify that configuring the hexDumpData works"; + testFramework.assert(configHexDumpStream.str() == correctConfigHexDumpStream.str(), failMesg, __LINE__); + + //Correct format for the printable, with Unix-Debain output of the 0x00, 0x10, and 0x85 hex values (first, second, and last values) + //A NEW METHOD OF CREATING THIS OUTPUT FOR THOSE UNIQUE CHARACTERS SHOULD BE MADE. AS IT IS NOW, THIS TEST WILL FAIL FOR OTHER + //OPERATING SYSTEMS OR COMPILERS. + correctPrintableMessage << "^@^P030105:eph :0:52640.33340277777778A Random Message25925924" + << " 2 52640.338836342592593 2 85412 1 1 0 1 1 4 2 4 0 0 3 1199 22c0af03" + << " 177029e4 af4001f e61b58a 55f3750 4cca887 115d7cfc 3ad2048a cea" + << " 362c48 1199 22c0af03 17704a74 3ac466c1 bd0c6dc 391b3783 3e040cf<85>"; + + printableMessageStream << printable(hexDumpString) ; + testFramework.changeSourceMethod("printable"); + failMesg = "Verify that prettyPrint works"; + testFramework.assert(printableMessageStream.str() == correctPrintableMessage.str(), failMesg, __LINE__); + + return testFramework.countFails(); + } /* ========================================================================================================================= - Test for the hexDump methods - - This test is intended to verify that the output formats are correct. - There are no characters that could be unique to the system configuration in these lists. -========================================================================================================================= */ - int hexDumpDataTest( void ) - { - TestUtil testFramework( "StringUtils", "hexDumpData", __FILE__, __LINE__ ); - std::string failMesg; - - - stringstream hexDumpStream; - stringstream correctHexDumpStream; - stringstream configHexDumpStream; - stringstream correctConfigHexDumpStream; - stringstream correctPrintableMessage; - stringstream printableMessageStream; - - char hexDumpArray[] = //Array of hex values to output - { 0x61, 0x66, 0x30, 0x33, 0x30, 0x31, 0x30, 0x35, - 0x3A, 0x65, 0x70, 0x68, 0x20, 0x3A, 0x30, 0x3A, - 0x35, 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, - 0x33, 0x34, 0x30, 0x32, 0x37, 0x37, 0x37, 0x37, - 0x37, 0x37, 0x37, 0x38, 0x41, 0x20, 0x52, 0x61, - 0x6e, 0x64, 0x6F, 0x6D, 0x20, 0x4D, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x39, 0x32, - 0x35, 0x39, 0x32, 0x34, 0x20, 0x32, 0x20, 0x35, - 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, 0x38, - 0x38, 0x33, 0x36, 0x33, 0x34, 0x32, 0x35, 0x39, - 0x32, 0x35, 0x39, 0x33, 0x20, 0x32, 0x20, 0x38, - 0x35, 0x34, 0x31, 0x32, 0x20, 0x31, 0x20, 0x31, - 0x20, 0x30, 0x20, 0x31, 0x20, 0x31, 0x20, 0x34, - 0x20, 0x32, 0x20, 0x34, 0x20, 0x30, 0x20, 0x30, - 0x20, 0x33, 0x20, 0x31, 0x31, 0x39, 0x39, 0x20, - 0x32, 0x32, 0x63, 0x30, 0x61, 0x66, 0x30, 0x33, - 0x20, 0x31, 0x37, 0x37, 0x30, 0x32, 0x39, 0x65, - 0x34, 0x20, 0x61, 0x66, 0x34, 0x30, 0x30, 0x31, - 0x66, 0x20, 0x65, 0x36, 0x31, 0x62, 0x35, 0x38, - 0x61, 0x20, 0x35, 0x35, 0x66, 0x33, 0x37, 0x35, - 0x30, 0x20, 0x34, 0x63, 0x63, 0x61, 0x38, 0x38, - 0x37, 0x20, 0x31, 0x31, 0x35, 0x64, 0x37, 0x63, - 0x66, 0x63, 0x20, 0x33, 0x61, 0x64, 0x32, 0x30, - 0x34, 0x38, 0x61, 0x20, 0x63, 0x65, 0x61, 0x20, - 0x33, 0x36, 0x32, 0x63, 0x34, 0x38, 0x20, 0x31, - 0x31, 0x39, 0x39, 0x20, 0x32, 0x32, 0x63, 0x30, - 0x61, 0x66, 0x30, 0x33, 0x20, 0x31, 0x37, 0x37, - 0x30, 0x34, 0x61, 0x37, 0x34, 0x20, 0x33, 0x61, - 0x63, 0x34, 0x36, 0x36, 0x63, 0x31, 0x20, 0x62, - 0x64, 0x30, 0x63, 0x36, 0x64, 0x63, 0x20, 0x33, - 0x39, 0x31, 0x62, 0x33, 0x37, 0x38, 0x33, 0x20, - 0x33, 0x65, 0x30, 0x34, 0x30, 0x63, 0x66, 0x65 }; - - //Correct format for hexDumpData - correctHexDumpStream << "0000: 61 66 30 33 30 31 30 35 3a 65 70 68 20 3a 30 3a af030105:eph :0:" << endl - << "0010: 35 32 36 34 30 2e 33 33 33 34 30 32 37 37 37 37 52640.3334027777" << endl - << "0020: 37 37 37 38 41 20 52 61 6e 64 6f 6d 20 4d 65 73 7778A Random Mes" << endl - << "0030: 73 61 67 65 32 35 39 32 35 39 32 34 20 32 20 35 sage25925924 2 5" << endl - << "0040: 32 36 34 30 2e 33 33 38 38 33 36 33 34 32 35 39 2640.33883634259" << endl - << "0050: 32 35 39 33 20 32 20 38 35 34 31 32 20 31 20 31 2593 2 85412 1 1" << endl - << "0060: 20 30 20 31 20 31 20 34 20 32 20 34 20 30 20 30 0 1 1 4 2 4 0 0" << endl - << "0070: 20 33 20 31 31 39 39 20 32 32 63 30 61 66 30 33 3 1199 22c0af03" << endl - << "0080: 20 31 37 37 30 32 39 65 34 20 61 66 34 30 30 31 177029e4 af4001" << endl - << "0090: 66 20 65 36 31 62 35 38 61 20 35 35 66 33 37 35 f e61b58a 55f375" << endl - << "00a0: 30 20 34 63 63 61 38 38 37 20 31 31 35 64 37 63 0 4cca887 115d7c" << endl - << "00b0: 66 63 20 33 61 64 32 30 34 38 61 20 63 65 61 20 fc 3ad2048a cea " << endl - << "00c0: 33 36 32 63 34 38 20 31 31 39 39 20 32 32 63 30 362c48 1199 22c0" << endl - << "00d0: 61 66 30 33 20 31 37 37 30 34 61 37 34 20 33 61 af03 17704a74 3a" << endl - << "00e0: 63 34 36 36 63 31 20 62 64 30 63 36 64 63 20 33 c466c1 bd0c6dc 3" << endl - << "00f0: 39 31 62 33 37 38 33 20 33 65 30 34 30 63 66 65 91b3783 3e040cfe" << endl; - - //Correct format for the configured hexDumpData - correctConfigHexDumpStream << " 00000000: 6166 3033 3031 3035 3A65 7068 203A 303A 'af030105:eph :0:'\n" - << " 00000010: 3532 3634 302E 3333 3334 3032 3737 3737 '52640.3334027777'\n" - << " 00000020: 3737 3738 4120 5261 6E64 6F6D 204D 6573 '7778A Random Mes'\n" - << " 00000030: 7361 6765 3235 3932 3539 3234 2032 2035 'sage25925924 2 5'\n" - << " 00000040: 3236 3430 2E33 3338 3833 3633 3432 3539 '2640.33883634259'\n" - << " 00000050: 3235 3933 2032 2038 3534 3132 2031 2031 '2593 2 85412 1 1'\n" - << " 00000060: 2030 2031 2031 2034 2032 2034 2030 2030 ' 0 1 1 4 2 4 0 0'\n" - << " 00000070: 2033 2031 3139 3920 3232 6330 6166 3033 ' 3 1199 22c0af03'\n" - << " 00000080: 2031 3737 3032 3965 3420 6166 3430 3031 ' 177029e4 af4001'\n" - << " 00000090: 6620 6536 3162 3538 6120 3535 6633 3735 'f e61b58a 55f375'\n" - << " 000000A0: 3020 3463 6361 3838 3720 3131 3564 3763 '0 4cca887 115d7c'\n" - << " 000000B0: 6663 2033 6164 3230 3438 6120 6365 6120 'fc 3ad2048a cea '\n" - << " 000000C0: 3336 3263 3438 2031 3139 3920 3232 6330 '362c48 1199 22c0'\n" - << " 000000D0: 6166 3033 2031 3737 3034 6137 3420 3361 'af03 17704a74 3a'\n" - << " 000000E0: 6334 3636 6331 2062 6430 6336 6463 2033 'c466c1 bd0c6dc 3'\n" - << " 000000F0: 3931 6233 3738 3320 3365 3034 3063 6665 '91b3783 3e040cfe'\n"; - - //Build the hexDumpString and output it to stringstream - string hexDumpString(hexDumpArray, sizeof(hexDumpArray)); - hexDumpData(hexDumpStream, hexDumpString); - - failMesg = "Verify that hexDumpData works"; - testFramework.assert(hexDumpStream.str() == correctHexDumpStream.str(), failMesg, __LINE__); - - //configure the hexDumpData, dump it to output stringstream - HexDumpDataConfig hdcfg(true, true, true, 8, 2, 2, 1, 0, 0, 16, true,'\'', 1); - hexDumpData(configHexDumpStream, hexDumpString, 6, hdcfg); - testFramework.changeSourceMethod("HexDumpDataConfig"); - - failMesg = "Verify that configuring the hexDumpData works"; - testFramework.assert(configHexDumpStream.str() == correctConfigHexDumpStream.str(), failMesg, __LINE__); - - //Correct format for the printable - correctPrintableMessage << "af030105:eph :0:52640.33340277777778A Random Message25925924" - << " 2 52640.338836342592593 2 85412 1 1 0 1 1 4 2 4 0 0 3 1199 22c0af03" - << " 177029e4 af4001f e61b58a 55f3750 4cca887 115d7cfc 3ad2048a cea" - << " 362c48 1199 22c0af03 17704a74 3ac466c1 bd0c6dc 391b3783 3e040cfe"; - - printableMessageStream << printable(hexDumpString) ; - testFramework.changeSourceMethod("printable"); - - failMesg = "Verify that prettyPrint works"; - testFramework.assert(printableMessageStream.str() == correctPrintableMessage.str(), failMesg, __LINE__); - - return testFramework.countFails(); - } + Test for the hexDump methods + + This test is intended to verify that the output formats are correct. + There are no characters that could be unique to the system configuration in these lists. + ========================================================================================================================= */ + int hexDumpDataTest( void ) + { + TestUtil testFramework( "StringUtils", "hexDumpData", __FILE__, __LINE__ ); + std::string failMesg; + + + stringstream hexDumpStream; + stringstream correctHexDumpStream; + stringstream configHexDumpStream; + stringstream correctConfigHexDumpStream; + stringstream correctPrintableMessage; + stringstream printableMessageStream; + + char hexDumpArray[] = //Array of hex values to output + { 0x61, 0x66, 0x30, 0x33, 0x30, 0x31, 0x30, 0x35, + 0x3A, 0x65, 0x70, 0x68, 0x20, 0x3A, 0x30, 0x3A, + 0x35, 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, + 0x33, 0x34, 0x30, 0x32, 0x37, 0x37, 0x37, 0x37, + 0x37, 0x37, 0x37, 0x38, 0x41, 0x20, 0x52, 0x61, + 0x6e, 0x64, 0x6F, 0x6D, 0x20, 0x4D, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x39, 0x32, + 0x35, 0x39, 0x32, 0x34, 0x20, 0x32, 0x20, 0x35, + 0x32, 0x36, 0x34, 0x30, 0x2E, 0x33, 0x33, 0x38, + 0x38, 0x33, 0x36, 0x33, 0x34, 0x32, 0x35, 0x39, + 0x32, 0x35, 0x39, 0x33, 0x20, 0x32, 0x20, 0x38, + 0x35, 0x34, 0x31, 0x32, 0x20, 0x31, 0x20, 0x31, + 0x20, 0x30, 0x20, 0x31, 0x20, 0x31, 0x20, 0x34, + 0x20, 0x32, 0x20, 0x34, 0x20, 0x30, 0x20, 0x30, + 0x20, 0x33, 0x20, 0x31, 0x31, 0x39, 0x39, 0x20, + 0x32, 0x32, 0x63, 0x30, 0x61, 0x66, 0x30, 0x33, + 0x20, 0x31, 0x37, 0x37, 0x30, 0x32, 0x39, 0x65, + 0x34, 0x20, 0x61, 0x66, 0x34, 0x30, 0x30, 0x31, + 0x66, 0x20, 0x65, 0x36, 0x31, 0x62, 0x35, 0x38, + 0x61, 0x20, 0x35, 0x35, 0x66, 0x33, 0x37, 0x35, + 0x30, 0x20, 0x34, 0x63, 0x63, 0x61, 0x38, 0x38, + 0x37, 0x20, 0x31, 0x31, 0x35, 0x64, 0x37, 0x63, + 0x66, 0x63, 0x20, 0x33, 0x61, 0x64, 0x32, 0x30, + 0x34, 0x38, 0x61, 0x20, 0x63, 0x65, 0x61, 0x20, + 0x33, 0x36, 0x32, 0x63, 0x34, 0x38, 0x20, 0x31, + 0x31, 0x39, 0x39, 0x20, 0x32, 0x32, 0x63, 0x30, + 0x61, 0x66, 0x30, 0x33, 0x20, 0x31, 0x37, 0x37, + 0x30, 0x34, 0x61, 0x37, 0x34, 0x20, 0x33, 0x61, + 0x63, 0x34, 0x36, 0x36, 0x63, 0x31, 0x20, 0x62, + 0x64, 0x30, 0x63, 0x36, 0x64, 0x63, 0x20, 0x33, + 0x39, 0x31, 0x62, 0x33, 0x37, 0x38, 0x33, 0x20, + 0x33, 0x65, 0x30, 0x34, 0x30, 0x63, 0x66, 0x65 }; + + //Correct format for hexDumpData + correctHexDumpStream << "0000: 61 66 30 33 30 31 30 35 3a 65 70 68 20 3a 30 3a af030105:eph :0:" << endl + << "0010: 35 32 36 34 30 2e 33 33 33 34 30 32 37 37 37 37 52640.3334027777" << endl + << "0020: 37 37 37 38 41 20 52 61 6e 64 6f 6d 20 4d 65 73 7778A Random Mes" << endl + << "0030: 73 61 67 65 32 35 39 32 35 39 32 34 20 32 20 35 sage25925924 2 5" << endl + << "0040: 32 36 34 30 2e 33 33 38 38 33 36 33 34 32 35 39 2640.33883634259" << endl + << "0050: 32 35 39 33 20 32 20 38 35 34 31 32 20 31 20 31 2593 2 85412 1 1" << endl + << "0060: 20 30 20 31 20 31 20 34 20 32 20 34 20 30 20 30 0 1 1 4 2 4 0 0" << endl + << "0070: 20 33 20 31 31 39 39 20 32 32 63 30 61 66 30 33 3 1199 22c0af03" << endl + << "0080: 20 31 37 37 30 32 39 65 34 20 61 66 34 30 30 31 177029e4 af4001" << endl + << "0090: 66 20 65 36 31 62 35 38 61 20 35 35 66 33 37 35 f e61b58a 55f375" << endl + << "00a0: 30 20 34 63 63 61 38 38 37 20 31 31 35 64 37 63 0 4cca887 115d7c" << endl + << "00b0: 66 63 20 33 61 64 32 30 34 38 61 20 63 65 61 20 fc 3ad2048a cea " << endl + << "00c0: 33 36 32 63 34 38 20 31 31 39 39 20 32 32 63 30 362c48 1199 22c0" << endl + << "00d0: 61 66 30 33 20 31 37 37 30 34 61 37 34 20 33 61 af03 17704a74 3a" << endl + << "00e0: 63 34 36 36 63 31 20 62 64 30 63 36 64 63 20 33 c466c1 bd0c6dc 3" << endl + << "00f0: 39 31 62 33 37 38 33 20 33 65 30 34 30 63 66 65 91b3783 3e040cfe" << endl; + + //Correct format for the configured hexDumpData + correctConfigHexDumpStream << " 00000000: 6166 3033 3031 3035 3A65 7068 203A 303A 'af030105:eph :0:'\n" + << " 00000010: 3532 3634 302E 3333 3334 3032 3737 3737 '52640.3334027777'\n" + << " 00000020: 3737 3738 4120 5261 6E64 6F6D 204D 6573 '7778A Random Mes'\n" + << " 00000030: 7361 6765 3235 3932 3539 3234 2032 2035 'sage25925924 2 5'\n" + << " 00000040: 3236 3430 2E33 3338 3833 3633 3432 3539 '2640.33883634259'\n" + << " 00000050: 3235 3933 2032 2038 3534 3132 2031 2031 '2593 2 85412 1 1'\n" + << " 00000060: 2030 2031 2031 2034 2032 2034 2030 2030 ' 0 1 1 4 2 4 0 0'\n" + << " 00000070: 2033 2031 3139 3920 3232 6330 6166 3033 ' 3 1199 22c0af03'\n" + << " 00000080: 2031 3737 3032 3965 3420 6166 3430 3031 ' 177029e4 af4001'\n" + << " 00000090: 6620 6536 3162 3538 6120 3535 6633 3735 'f e61b58a 55f375'\n" + << " 000000A0: 3020 3463 6361 3838 3720 3131 3564 3763 '0 4cca887 115d7c'\n" + << " 000000B0: 6663 2033 6164 3230 3438 6120 6365 6120 'fc 3ad2048a cea '\n" + << " 000000C0: 3336 3263 3438 2031 3139 3920 3232 6330 '362c48 1199 22c0'\n" + << " 000000D0: 6166 3033 2031 3737 3034 6137 3420 3361 'af03 17704a74 3a'\n" + << " 000000E0: 6334 3636 6331 2062 6430 6336 6463 2033 'c466c1 bd0c6dc 3'\n" + << " 000000F0: 3931 6233 3738 3320 3365 3034 3063 6665 '91b3783 3e040cfe'\n"; + + //Build the hexDumpString and output it to stringstream + string hexDumpString(hexDumpArray, sizeof(hexDumpArray)); + hexDumpData(hexDumpStream, hexDumpString); + + failMesg = "Verify that hexDumpData works"; + testFramework.assert(hexDumpStream.str() == correctHexDumpStream.str(), failMesg, __LINE__); + + //configure the hexDumpData, dump it to output stringstream + HexDumpDataConfig hdcfg(true, true, true, 8, 2, 2, 1, 0, 0, 16, true,'\'', 1); + hexDumpData(configHexDumpStream, hexDumpString, 6, hdcfg); + testFramework.changeSourceMethod("HexDumpDataConfig"); + + failMesg = "Verify that configuring the hexDumpData works"; + testFramework.assert(configHexDumpStream.str() == correctConfigHexDumpStream.str(), failMesg, __LINE__); + + //Correct format for the printable + correctPrintableMessage << "af030105:eph :0:52640.33340277777778A Random Message25925924" + << " 2 52640.338836342592593 2 85412 1 1 0 1 1 4 2 4 0 0 3 1199 22c0af03" + << " 177029e4 af4001f e61b58a 55f3750 4cca887 115d7cfc 3ad2048a cea" + << " 362c48 1199 22c0af03 17704a74 3ac466c1 bd0c6dc 391b3783 3e040cfe"; + + printableMessageStream << printable(hexDumpString) ; + testFramework.changeSourceMethod("printable"); + + failMesg = "Verify that prettyPrint works"; + testFramework.assert(printableMessageStream.str() == correctPrintableMessage.str(), failMesg, __LINE__); + + return testFramework.countFails(); + } }; int main() //Main function to initialize and run all tests above { - int check, errorCounter = 0; - StringUtils_T testClass; + int check, errorCounter = 0; + StringUtils_T testClass; - check = testClass.justificationTest(); - errorCounter += check; + check = testClass.justificationTest(); + errorCounter += check; - check = testClass.stripLeadingTest(); - errorCounter += check; + check = testClass.stripLeadingTest(); + errorCounter += check; - check = testClass.stripTrailingTest(); - errorCounter += check; + check = testClass.stripTrailingTest(); + errorCounter += check; - check = testClass.stripTest(); - errorCounter += check; + check = testClass.stripTest(); + errorCounter += check; - check = testClass.stringToNumberTest(); - errorCounter += check; + check = testClass.stringToNumberTest(); + errorCounter += check; - check = testClass.numberToStringTest(); - errorCounter += check; + check = testClass.numberToStringTest(); + errorCounter += check; - check = testClass.hexConversionTest(); - errorCounter += check; + check = testClass.hexConversionTest(); + errorCounter += check; - check = testClass.stringReplaceTest(); - errorCounter += check; + check = testClass.stringReplaceTest(); + errorCounter += check; - check = testClass.wordTest(); - errorCounter += check; + check = testClass.wordTest(); + errorCounter += check; - check = testClass.regularExpressionsTest(); - errorCounter += check; + check = testClass.regularExpressionsTest(); + errorCounter += check; - check = testClass.prettyPrintTest(); - errorCounter += check; + check = testClass.prettyPrintTest(); + errorCounter += check; - check = testClass.splitOnWhitespaceTest(); - errorCounter += check; + check = testClass.splitWithQuotesTest(); + errorCounter += check; - check = testClass.hexDumpDataTest(); - errorCounter += check; + check = testClass.hexDumpDataTest(); + errorCounter += check; - check = testClass.hexToAsciiTest(); - errorCounter += check; + check = testClass.hexToAsciiTest(); + errorCounter += check; - std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; + std::cout << "Total Failures for " << __FILE__ << ": " << errorCounter << std::endl; - return errorCounter; //Return the total number of errors + return errorCounter; //Return the total number of errors } diff --git a/core/tests/Utilities/ValidType_T.cpp b/core/tests/Utilities/ValidType_T.cpp index 027197641..99fe6f37f 100644 --- a/core/tests/Utilities/ValidType_T.cpp +++ b/core/tests/Utilities/ValidType_T.cpp @@ -3,119 +3,120 @@ #include #include #include +#include class ValidType_T { - public: - ValidType_T(){ eps = 1E-12;}// Default Constructor, set the precision value - ~ValidType_T() {} // Default Desructor +public: + ValidType_T(){ eps = 1E-12;}// Default Constructor, set the precision value + ~ValidType_T() {} // Default Desructor - int methodTest(void) - { - TestUtil testFramework( "ValidType", "Various Methods", __FILE__, __LINE__ ); - std::string failMesg; + int methodTest(void) + { + TestUtil testFramework( "ValidType", "Various Methods", __FILE__, __LINE__ ); + std::string failMesg; - gpstk::ValidType vfloat0; + gpstk::ValidType vfloat0; - failMesg = "Is the invalid Valid object set as valid?"; - testFramework.assert(!vfloat0.is_valid(), failMesg, __LINE__); + failMesg = "Is the invalid Valid object set as valid?"; + testFramework.assert(!vfloat0.is_valid(), failMesg, __LINE__); - failMesg = "Is the invalid Valid object's value 0?"; - testFramework.assert(abs(vfloat0.get_value()) < eps, failMesg, __LINE__); + failMesg = "Is the invalid Valid object's value 0?"; + testFramework.assert(std::abs(vfloat0.get_value()) < eps, failMesg, __LINE__); - gpstk::ValidType vfloat (5); + gpstk::ValidType vfloat (5); - failMesg = "Does the get_value method return the correct value?"; - testFramework.assert(vfloat.get_value() == 5, failMesg, __LINE__); + failMesg = "Does the get_value method return the correct value?"; + testFramework.assert(vfloat.get_value() == 5, failMesg, __LINE__); - failMesg = "Is the valid Valid object set as valid?"; - testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); + failMesg = "Is the valid Valid object set as valid?"; + testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); - vfloat.set_valid(false); + vfloat.set_valid(false); - failMesg = "Was the valid Valid object correctly set to invalid?"; - testFramework.assert(!vfloat.is_valid(), failMesg, __LINE__); + failMesg = "Was the valid Valid object correctly set to invalid?"; + testFramework.assert(!vfloat.is_valid(), failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } - int operatorTest(void) - { - TestUtil testFramework( "ValidType", "== Operator", __FILE__, __LINE__ ); - std::string failMesg; + int operatorTest(void) + { + TestUtil testFramework( "ValidType", "== Operator", __FILE__, __LINE__ ); + std::string failMesg; - gpstk::ValidType Compare1 (6.); - gpstk::ValidType Compare2 (6.); - gpstk::ValidType Compare3 (8.); - gpstk::ValidType Compare4 (6); - gpstk::ValidType vfloat; + gpstk::ValidType Compare1 (6.); + gpstk::ValidType Compare2 (6.); + gpstk::ValidType Compare3 (8.); + gpstk::ValidType Compare4 (6); + gpstk::ValidType vfloat; - failMesg = "Are two equvalent objects equal?"; - testFramework.assert(Compare1 == Compare2, failMesg, __LINE__); + failMesg = "Are two equvalent objects equal?"; + testFramework.assert(Compare1 == Compare2, failMesg, __LINE__); - failMesg = "Are two non-equvalent objects equal?"; - testFramework.assert(Compare1 != Compare3, failMesg, __LINE__); + failMesg = "Are two non-equvalent objects equal?"; + testFramework.assert(Compare1 != Compare3, failMesg, __LINE__); - vfloat = 7.; + vfloat = 7.; - testFramework.changeSourceMethod("= Operator"); - failMesg = "Did the = operator store the value correctly?"; - testFramework.assert(vfloat.get_value() == 7., failMesg, __LINE__); + testFramework.changeSourceMethod("= Operator"); + failMesg = "Did the = operator store the value correctly?"; + testFramework.assert(vfloat.get_value() == 7., failMesg, __LINE__); - failMesg = "Did the = operator set the object as valid?"; - testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); + failMesg = "Did the = operator set the object as valid?"; + testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); - testFramework.changeSourceMethod("+= Operator"); + testFramework.changeSourceMethod("+= Operator"); - vfloat += 3.; - failMesg = "Did the += operator store the value correctly?"; - testFramework.assert(vfloat.get_value() == 10., failMesg, __LINE__); + vfloat += 3.; + failMesg = "Did the += operator store the value correctly?"; + testFramework.assert(vfloat.get_value() == 10., failMesg, __LINE__); - failMesg = "Did the += operator change the object's valid bool?"; - testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); + failMesg = "Did the += operator change the object's valid bool?"; + testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); - testFramework.changeSourceMethod("-= Operator"); + testFramework.changeSourceMethod("-= Operator"); - vfloat -= 5.; + vfloat -= 5.; - failMesg = "Did the -= operator store the value correctly?"; - testFramework.assert(vfloat.get_value() == 5., failMesg, __LINE__); + failMesg = "Did the -= operator store the value correctly?"; + testFramework.assert(vfloat.get_value() == 5., failMesg, __LINE__); - failMesg = "Did the -= operator change the object's valid bool?"; - testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); + failMesg = "Did the -= operator change the object's valid bool?"; + testFramework.assert(vfloat.is_valid(), failMesg, __LINE__); - testFramework.changeSourceMethod("<< Operator"); + testFramework.changeSourceMethod("<< Operator"); - vfloat = 11; + vfloat = 11; - std::stringstream streamOutput; - std::string stringOutput; - std::string stringCompare; + std::stringstream streamOutput; + std::string stringOutput; + std::string stringCompare; - streamOutput << vfloat; - stringOutput = streamOutput.str(); + streamOutput << vfloat; + stringOutput = streamOutput.str(); - stringCompare = "11"; + stringCompare = "11"; - failMesg = "Did the << operator ouput valid object correctly?"; - testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__); + failMesg = "Did the << operator ouput valid object correctly?"; + testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__); - streamOutput.str(""); // Resetting stream - vfloat.set_valid(false); + streamOutput.str(""); // Resetting stream + vfloat.set_valid(false); - streamOutput << vfloat; - stringOutput = streamOutput.str(); + streamOutput << vfloat; + stringOutput = streamOutput.str(); - stringCompare = "Unknown"; + stringCompare = "Unknown"; - failMesg = " Did the << operator output invalid object correctly?"; - testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__); + failMesg = " Did the << operator output invalid object correctly?"; + testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__); - return testFramework.countFails(); - } + return testFramework.countFails(); + } - private: - double eps; +private: + double eps; }; int main() //Main function to initialize and run all tests above diff --git a/data/test_input_gps_almanac.txt b/data/test_input_gps_almanac.txt new file mode 100644 index 000000000..5089f20dc --- /dev/null +++ b/data/test_input_gps_almanac.txt @@ -0,0 +1,464 @@ +******** Week 819 almanac for PRN-01 ******** +ID: 01 +Health: 000 +Eccentricity: 0.4164695740E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9617124771 +Rate of Right Ascen(r/s): -0.7954617056E-008 +SQRT(A) (m 1/2): 5153.605957 +Right Ascen at Week(rad): -0.1551930535E+001 +Argument of Perigee(rad): 0.374535865 +Mean Anom(rad): -0.3011159346E+001 +Af0(s): -0.5722045898E-005 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-02 ******** +ID: 02 +Health: 000 +Eccentricity: 0.1465082169E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9403505962 +Rate of Right Ascen(r/s): -0.8137481816E-008 +SQRT(A) (m 1/2): 5153.748047 +Right Ascen at Week(rad): -0.1589058039E+001 +Argument of Perigee(rad): -2.273130329 +Mean Anom(rad): -0.2569705816E+001 +Af0(s): 0.5645751953E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-03 ******** +ID: 03 +Health: 000 +Eccentricity: 0.9121894836E-003 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9594234901 +Rate of Right Ascen(r/s): -0.7920329914E-008 +SQRT(A) (m 1/2): 5153.634766 +Right Ascen at Week(rad): -0.5110751357E+000 +Argument of Perigee(rad): -2.679750961 +Mean Anom(rad): -0.1046916796E+001 +Af0(s): 0.3194808960E-003 +Af1(s/s): 0.1091393642E-010 +week: 819 + +******** Week 819 almanac for PRN-04 ******** +ID: 04 +Health: 000 +Eccentricity: 0.1121425629E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9394038424 +Rate of Right Ascen(r/s): -0.8194627053E-008 +SQRT(A) (m 1/2): 5153.631836 +Right Ascen at Week(rad): -0.1573754932E+001 +Argument of Perigee(rad): 1.056810522 +Mean Anom(rad): 0.3017485144E+001 +Af0(s): -0.1335144043E-004 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-05 ******** +ID: 05 +Health: 000 +Eccentricity: 0.4126548767E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9466483063 +Rate of Right Ascen(r/s): -0.8057478483E-008 +SQRT(A) (m 1/2): 5153.487793 +Right Ascen at Week(rad): -0.5178211308E+000 +Argument of Perigee(rad): 0.378114654 +Mean Anom(rad): -0.1106675759E+000 +Af0(s): -0.2450942993E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-06 ******** +ID: 06 +Health: 000 +Eccentricity: 0.1826286316E-003 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9616046190 +Rate of Right Ascen(r/s): -0.7920329914E-008 +SQRT(A) (m 1/2): 5153.684082 +Right Ascen at Week(rad): -0.1560445327E+001 +Argument of Perigee(rad): -2.828490921 +Mean Anom(rad): -0.1345099292E+001 +Af0(s): 0.1535415649E-003 +Af1(s/s): 0.1091393642E-010 +week: 819 + +******** Week 819 almanac for PRN-07 ******** +ID: 07 +Health: 000 +Eccentricity: 0.8272647858E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9702033004 +Rate of Right Ascen(r/s): -0.8103194673E-008 +SQRT(A) (m 1/2): 5153.670410 +Right Ascen at Week(rad): 0.1608185236E+001 +Argument of Perigee(rad): -2.756533141 +Mean Anom(rad): 0.2633976465E+001 +Af0(s): 0.4606246948E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-09 ******** +ID: 09 +Health: 000 +Eccentricity: 0.4372596741E-003 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9579853831 +Rate of Right Ascen(r/s): -0.7726036106E-008 +SQRT(A) (m 1/2): 5153.562012 +Right Ascen at Week(rad): 0.5317486727E+000 +Argument of Perigee(rad): 2.574316372 +Mean Anom(rad): -0.1557444777E+001 +Af0(s): -0.1516342163E-003 +Af1(s/s): -0.7275957614E-011 +week: 819 + +******** Week 819 almanac for PRN-10 ******** +ID: 10 +Health: 000 +Eccentricity: 0.1467323303E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9414531448 +Rate of Right Ascen(r/s): -0.8068907531E-008 +SQRT(A) (m 1/2): 5153.620605 +Right Ascen at Week(rad): -0.5026138984E+000 +Argument of Perigee(rad): 0.928847088 +Mean Anom(rad): 0.2413682817E+000 +Af0(s): -0.1735687256E-003 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-11 ******** +ID: 11 +Health: 000 +Eccentricity: 0.1571178436E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.8926953258 +Rate of Right Ascen(r/s): -0.8537498478E-008 +SQRT(A) (m 1/2): 5153.662109 +Right Ascen at Week(rad): -0.1901289042E+001 +Argument of Perigee(rad): 1.400536444 +Mean Anom(rad): 0.2694641360E+001 +Af0(s): -0.5760192871E-003 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-12 ******** +ID: 12 +Health: 000 +Eccentricity: 0.5569458008E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9897855239 +Rate of Right Ascen(r/s): -0.7817468486E-008 +SQRT(A) (m 1/2): 5153.647461 +Right Ascen at Week(rad): 0.2676926429E+001 +Argument of Perigee(rad): 0.581916885 +Mean Anom(rad): 0.2101364179E+001 +Af0(s): 0.2908706665E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-13 ******** +ID: 13 +Health: 000 +Eccentricity: 0.5193710327E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9746494478 +Rate of Right Ascen(r/s): -0.7588887536E-008 +SQRT(A) (m 1/2): 5153.644043 +Right Ascen at Week(rad): 0.6465122320E+000 +Argument of Perigee(rad): 2.080177942 +Mean Anom(rad): -0.2894083580E+001 +Af0(s): -0.1125335693E-003 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-14 ******** +ID: 14 +Health: 000 +Eccentricity: 0.8051872253E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9671652994 +Rate of Right Ascen(r/s): -0.7668890869E-008 +SQRT(A) (m 1/2): 5153.549316 +Right Ascen at Week(rad): 0.6120617049E+000 +Argument of Perigee(rad): -1.976021920 +Mean Anom(rad): -0.1004405005E+001 +Af0(s): 0.6580352783E-004 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-15 ******** +ID: 15 +Health: 000 +Eccentricity: 0.7133960724E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9338851068 +Rate of Right Ascen(r/s): -0.7943188009E-008 +SQRT(A) (m 1/2): 5153.584961 +Right Ascen at Week(rad): 0.4886672567E+000 +Argument of Perigee(rad): 0.390519825 +Mean Anom(rad): -0.1648097199E+001 +Af0(s): -0.2479553223E-003 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-16 ******** +ID: 16 +Health: 000 +Eccentricity: 0.8190631866E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9903487825 +Rate of Right Ascen(r/s): -0.7806039439E-008 +SQRT(A) (m 1/2): 5153.505371 +Right Ascen at Week(rad): 0.2695595230E+001 +Argument of Perigee(rad): 0.291140640 +Mean Anom(rad): -0.8730882351E-002 +Af0(s): -0.1316070557E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-17 ******** +ID: 17 +Health: 000 +Eccentricity: 0.1010608673E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9724083978 +Rate of Right Ascen(r/s): -0.7577458489E-008 +SQRT(A) (m 1/2): 5153.717773 +Right Ascen at Week(rad): -0.2561268921E+001 +Argument of Perigee(rad): -2.010452598 +Mean Anom(rad): -0.9209996682E+000 +Af0(s): -0.1697540283E-003 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-18 ******** +ID: 18 +Health: 000 +Eccentricity: 0.1614856720E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9252145201 +Rate of Right Ascen(r/s): -0.8263201338E-008 +SQRT(A) (m 1/2): 5153.534668 +Right Ascen at Week(rad): -0.5305090544E+000 +Argument of Perigee(rad): -1.966799684 +Mean Anom(rad): 0.5661201788E+000 +Af0(s): 0.3995895386E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-19 ******** +ID: 19 +Health: 000 +Eccentricity: 0.1131820679E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9694482942 +Rate of Right Ascen(r/s): -0.7566029441E-008 +SQRT(A) (m 1/2): 5153.682129 +Right Ascen at Week(rad): -0.2511611911E+001 +Argument of Perigee(rad): 0.538696527 +Mean Anom(rad): -0.1704766479E+001 +Af0(s): -0.5092620850E-003 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-20 ******** +ID: 20 +Health: 000 +Eccentricity: 0.5660533905E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9263530215 +Rate of Right Ascen(r/s): -0.8263201338E-008 +SQRT(A) (m 1/2): 5155.734863 +Right Ascen at Week(rad): -0.5829647559E+000 +Argument of Perigee(rad): 1.217092789 +Mean Anom(rad): -0.8373441608E+000 +Af0(s): 0.3175735474E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-21 ******** +ID: 21 +Health: 000 +Eccentricity: 0.2255344391E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9334057378 +Rate of Right Ascen(r/s): -0.8194627053E-008 +SQRT(A) (m 1/2): 5153.505859 +Right Ascen at Week(rad): -0.1574290103E+001 +Argument of Perigee(rad): -1.913066539 +Mean Anom(rad): 0.1669454586E+001 +Af0(s): -0.4434585571E-003 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-22 ******** +ID: 22 +Health: 000 +Eccentricity: 0.7876396179E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9230273991 +Rate of Right Ascen(r/s): -0.8274630386E-008 +SQRT(A) (m 1/2): 5153.623535 +Right Ascen at Week(rad): -0.5293023928E+000 +Argument of Perigee(rad): -2.052691373 +Mean Anom(rad): 0.1336967621E+000 +Af0(s): 0.3471374512E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-23 ******** +ID: 23 +Health: 000 +Eccentricity: 0.1009654999E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9490151908 +Rate of Right Ascen(r/s): -0.7783181344E-008 +SQRT(A) (m 1/2): 5153.578613 +Right Ascen at Week(rad): 0.5405514604E+000 +Argument of Perigee(rad): -2.688801298 +Mean Anom(rad): -0.2109344175E+001 +Af0(s): -0.1068115234E-003 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-24 ******** +ID: 24 +Health: 000 +Eccentricity: 0.3237247467E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9534253855 +Rate of Right Ascen(r/s): -0.8274630386E-008 +SQRT(A) (m 1/2): 5153.622070 +Right Ascen at Week(rad): 0.1567643352E+001 +Argument of Perigee(rad): 0.361305281 +Mean Anom(rad): -0.2860896265E+001 +Af0(s): -0.4768371582E-004 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-25 ******** +ID: 25 +Health: 000 +Eccentricity: 0.4587173462E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9782686838 +Rate of Right Ascen(r/s): -0.7954617056E-008 +SQRT(A) (m 1/2): 5153.639648 +Right Ascen at Week(rad): 0.2630553845E+001 +Argument of Perigee(rad): 0.712042348 +Mean Anom(rad): 0.1425497337E+001 +Af0(s): -0.2670288086E-004 +Af1(s/s): -0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-26 ******** +ID: 26 +Health: 000 +Eccentricity: 0.2794265747E-003 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9603882202 +Rate of Right Ascen(r/s): -0.8137481816E-008 +SQRT(A) (m 1/2): 5153.514648 +Right Ascen at Week(rad): 0.2628337138E+001 +Argument of Perigee(rad): 1.174125224 +Mean Anom(rad): -0.3991855434E+000 +Af0(s): 0.2765655518E-004 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-27 ******** +ID: 27 +Health: 000 +Eccentricity: 0.2393722534E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9673210943 +Rate of Right Ascen(r/s): -0.7611745631E-008 +SQRT(A) (m 1/2): 5153.648926 +Right Ascen at Week(rad): -0.2608893857E+001 +Argument of Perigee(rad): 0.187259881 +Mean Anom(rad): -0.8328893997E+000 +Af0(s): 0.6961822510E-004 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-28 ******** +ID: 28 +Health: 000 +Eccentricity: 0.1952505112E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9889586124 +Rate of Right Ascen(r/s): -0.7794610391E-008 +SQRT(A) (m 1/2): 5153.652344 +Right Ascen at Week(rad): 0.2700964162E+001 +Argument of Perigee(rad): -1.664690482 +Mean Anom(rad): -0.8634708946E-001 +Af0(s): 0.4377365112E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-29 ******** +ID: 29 +Health: 000 +Eccentricity: 0.1315116882E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9732413014 +Rate of Right Ascen(r/s): -0.7577458489E-008 +SQRT(A) (m 1/2): 5153.727051 +Right Ascen at Week(rad): -0.2551925345E+001 +Argument of Perigee(rad): -0.648313611 +Mean Anom(rad): 0.1766370638E+001 +Af0(s): 0.6084442139E-003 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-30 ******** +ID: 30 +Health: 000 +Eccentricity: 0.1322746277E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9559300885 +Rate of Right Ascen(r/s): -0.8263201338E-008 +SQRT(A) (m 1/2): 5153.691895 +Right Ascen at Week(rad): 0.1657832884E+001 +Argument of Perigee(rad): 2.849603755 +Mean Anom(rad): 0.2801215200E+001 +Af0(s): -0.6294250488E-004 +Af1(s/s): 0.3637978807E-011 +week: 819 + +******** Week 819 almanac for PRN-31 ******** +ID: 31 +Health: 000 +Eccentricity: 0.8122444153E-002 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9750868720 +Rate of Right Ascen(r/s): -0.8057478483E-008 +SQRT(A) (m 1/2): 5153.727051 +Right Ascen at Week(rad): 0.1615850646E+001 +Argument of Perigee(rad): -0.516093155 +Mean Anom(rad): 0.2468229766E+001 +Af0(s): 0.3166198730E-003 +Af1(s/s): 0.0000000000E+000 +week: 819 + +******** Week 819 almanac for PRN-32 ******** +ID: 32 +Health: 000 +Eccentricity: 0.1126098633E-001 +Time of Applicability(s): 319488.0000 +Orbital Inclination(rad): 0.9471756122 +Rate of Right Ascen(r/s): -0.8000333246E-008 +SQRT(A) (m 1/2): 5153.717285 +Right Ascen at Week(rad): -0.4289667168E+000 +Argument of Perigee(rad): 0.042980674 +Mean Anom(rad): 0.3110769976E+001 +Af0(s): -0.1583099365E-003 +Af1(s/s): 0.1091393642E-010 +week: 819 diff --git a/data/test_input_rinex2_clock_BadEpochLine.96c b/data/test_input_rinex2_clock_BadEpochLine.96c new file mode 100644 index 000000000..7de5f04f5 --- /dev/null +++ b/data/test_input_rinex2_clock_BadEpochLine.96c @@ -0,0 +1,31 @@ + 2.00 CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +ARAREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 diff --git a/data/test_input_rinex2_clock_IncompleteHeader.96c b/data/test_input_rinex2_clock_IncompleteHeader.96c new file mode 100644 index 000000000..6e1979191 --- /dev/null +++ b/data/test_input_rinex2_clock_IncompleteHeader.96c @@ -0,0 +1,22 @@ + 2.00 CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex2_clock_InvalidLineLength.96c b/data/test_input_rinex2_clock_InvalidLineLength.96c new file mode 100644 index 000000000..2a042e28c --- /dev/null +++ b/data/test_input_rinex2_clock_InvalidLineLength.96c @@ -0,0 +1,31 @@ + 2.00 CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS zzzzzzzzzz + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 diff --git a/data/test_input_rinex2_clock_NotAClockFile.96c b/data/test_input_rinex2_clock_NotAClockFile.96c new file mode 100644 index 000000000..daebb622a --- /dev/null +++ b/data/test_input_rinex2_clock_NotAClockFile.96c @@ -0,0 +1,31 @@ + 2.00 NOT CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 diff --git a/data/test_input_rinex2_clock_RinexClockExample.96c b/data/test_input_rinex2_clock_RinexClockExample.96c new file mode 100644 index 000000000..bcc1d52a8 --- /dev/null +++ b/data/test_input_rinex2_clock_RinexClockExample.96c @@ -0,0 +1,31 @@ + 2.00 CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 diff --git a/data/test_input_rinex2_clock_UnknownHeaderLabel.96c b/data/test_input_rinex2_clock_UnknownHeaderLabel.96c new file mode 100644 index 000000000..6fc3c88e6 --- /dev/null +++ b/data/test_input_rinex2_clock_UnknownHeaderLabel.96c @@ -0,0 +1,32 @@ + 2.00 CLOCK DATA RINEX VERSION / TYPE +TORINEXC V9.9 USNO 3-APR-96 00:10 PGM / RUN BY / DATE +CLK ANT Z-OFFSET(M): II/IIA 1.023; IIR 0.000 COMMENT +EXAMPLE OF A CLOCK DATA FILE COMMENT +IN THIS CASE ANALYSIS RESULTS ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT + 10 LEAP SECONDS + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + NOT A LABEL + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 diff --git a/data/test_input_rinex2_nav_BadHeader.99n b/data/test_input_rinex2_nav_BadHeader.99n new file mode 100644 index 000000000..88bdf5801 --- /dev/null +++ b/data/test_input_rinex2_nav_BadHeader.99n @@ -0,0 +1,8 @@ + 3.33 N : GPS NAV DATA DATARINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER diff --git a/data/test_input_rinex2_nav_FilterTest1.99n b/data/test_input_rinex2_nav_FilterTest1.99n new file mode 100644 index 000000000..dec360ebc --- /dev/null +++ b/data/test_input_rinex2_nav_FilterTest1.99n @@ -0,0 +1,24 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +THIS IS ONE COMMENT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER + 6 99 9 2 17 51 44.0 -.839701388031D-03 -.165982783074D-10 .000000000000D+00 + .910000000000D+02 .934062500000D+02 .116040547840D-08 .162092304801D+00 + .484101474285D-05 .626740418375D-02 .652112066746D-05 .515365489006D+04 + .409904000000D+06 -.242143869400D-07 .329237003460D+00 -.596046447754D-07 + .111541663136D+01 .326593750000D+03 .206958726335D+01 -.638312302555D-08 + .307155651409D-09 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .910000000000D+02 + .406800000000D+06 .000000000000D+00 +13 99 9 2 19 0 0.0 .490025617182D-03 .204636307899D-11 .000000000000D+00 + .133000000000D+03 -.963125000000D+02 .146970407622D-08 .292961152146D+01 + -.498816370964D-05 .200239347760D-02 .928156077862D-05 .515328476143D+04 + .414000000000D+06 -.279396772385D-07 .243031939942D+01 -.558793544769D-07 + .110192796930D+01 .271187500000D+03 -.232757915425D+01 -.619632953057D-08 + -.785747015231D-11 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .389000000000D+03 + .410400000000D+06 .000000000000D+00 \ No newline at end of file diff --git a/data/test_input_rinex2_nav_FilterTest2.99n b/data/test_input_rinex2_nav_FilterTest2.99n new file mode 100644 index 000000000..a30cd6dbf --- /dev/null +++ b/data/test_input_rinex2_nav_FilterTest2.99n @@ -0,0 +1,24 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +THIS IS A DIFFERENT COMMENT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER + 6 99 9 2 17 51 44.0 -.839701388031D-03 -.165982783074D-10 .000000000000D+00 + .910000000000D+02 .934062500000D+02 .116040547840D-08 .162092304801D+00 + .484101474285D-05 .626740418375D-02 .652112066746D-05 .515365489006D+04 + .409904000000D+06 -.242143869400D-07 .329237003460D+00 -.596046447754D-07 + .111541663136D+01 .326593750000D+03 .206958726335D+01 -.638312302555D-08 + .307155651409D-09 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .910000000000D+02 + .406800000000D+06 .000000000000D+00 +13 99 9 2 19 0 0.0 .490025617182D-03 .204636307899D-11 .000000000000D+00 + .133000000000D+03 -.963125000000D+02 .146970407622D-08 .292961152146D+01 + -.498816370964D-05 .200239347760D-02 .928156077862D-05 .515328476143D+04 + .414000000000D+06 -.279396772385D-07 .243031939942D+01 -.558793544769D-07 + .110192796930D+01 .271187500000D+03 -.232757915425D+01 -.619632953057D-08 + -.785747015231D-11 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .389000000000D+03 + .410400000000D+06 .000000000000D+00 \ No newline at end of file diff --git a/data/test_input_rinex2_nav_FilterTest3.99n b/data/test_input_rinex2_nav_FilterTest3.99n new file mode 100644 index 000000000..7211d9a49 --- /dev/null +++ b/data/test_input_rinex2_nav_FilterTest3.99n @@ -0,0 +1,24 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER + 6 99 9 2 00 19 44.0 -.839701388031D-03 -.165982783074D-10 .000000000000D+00 + .910000000000D+02 .934062500000D+02 .116040547840D-08 .162092304801D+00 + .484101474285D-05 .626740418375D-02 .652112066746D-05 .515365489006D+04 + .409904000000D+06 -.242143869400D-07 .329237003460D+00 -.596046447754D-07 + .111541663136D+01 .326593750000D+03 .206958726335D+01 -.638312302555D-08 + .307155651409D-09 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .910000000000D+02 + .406800000000D+06 .000000000000D+00 +13 99 9 2 00 00 0.0 .490025617182D-03 .204636307899D-11 .000000000000D+00 + .133000000000D+03 -.963125000000D+02 .146970407622D-08 .292961152146D+01 + -.498816370964D-05 .200239347760D-02 .928156077862D-05 .515328476143D+04 + .414000000000D+06 -.279396772385D-07 .243031939942D+01 -.558793544769D-07 + .110192796930D+01 .271187500000D+03 -.232757915425D+01 -.619632953057D-08 + -.785747015231D-11 .000000000000D+00 .102500000000D+04 .000000000000D+00 + .000000000000D+00 .000000000000D+00 .000000000000D+00 .389000000000D+03 + .410400000000D+06 .000000000000D+00 \ No newline at end of file diff --git a/data/test_input_rinex2_nav_IncompleteHeader.99n b/data/test_input_rinex2_nav_IncompleteHeader.99n new file mode 100644 index 000000000..68c97cfdd --- /dev/null +++ b/data/test_input_rinex2_nav_IncompleteHeader.99n @@ -0,0 +1,7 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex2_nav_InvalidLineLength.99n b/data/test_input_rinex2_nav_InvalidLineLength.99n new file mode 100644 index 000000000..7de843d62 --- /dev/null +++ b/data/test_input_rinex2_nav_InvalidLineLength.99n @@ -0,0 +1,8 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPEEEEEE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex2_nav_NotaNavFile.99n b/data/test_input_rinex2_nav_NotaNavFile.99n new file mode 100644 index 000000000..1bd1b7cb1 --- /dev/null +++ b/data/test_input_rinex2_nav_NotaNavFile.99n @@ -0,0 +1,8 @@ + 2.10 Z : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex2_nav_RinexNavExample.99n b/data/test_input_rinex2_nav_RinexNavExample.99n new file mode 100644 index 000000000..01bec10a1 --- /dev/null +++ b/data/test_input_rinex2_nav_RinexNavExample.99n @@ -0,0 +1,24 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +THIS IS ONE COMMENT COMMENT + 1.6760e-08 2.2350e-08 -1.1920e-07 -1.1920e-07 ION ALPHA + 1.2080e+05 1.3100e+05 -1.3100e+05 -1.9660e+05 ION BETA + 1.331791281700e-07 1.074695887800e-13 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER + 6 99 9 2 17 51 44.0-8.397013880310e-04-1.659827830740e-11 0.000000000000e+00 + 9.100000000000e+01 9.340625000000e+01 1.160405478400e-09 1.620923048010e-01 + 4.841014742850e-06 6.267404183750e-03 6.521120667460e-06 5.153654890060e+03 + 4.099040000000e+05-2.421438694000e-08 3.292370034600e-01-5.960464477540e-08 + 1.115416631360e+00 3.265937500000e+02 2.069587263350e+00-6.383123025550e-09 + 3.071556514090e-10 0.000000000000e+00 1.025000000000e+03 0.000000000000e+00 + 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 9.100000000000e+01 + 4.068000000000e+05 0.000000000000e+00 +13 99 9 2 19 0 0.0 4.900256171820e-04 2.046363078990e-12 0.000000000000e+00 + 1.330000000000e+02-9.631250000000e+01 1.469704076220e-09 2.929611521460e+00 + -4.988163709640e-06 2.002393477600e-03 9.281560778620e-06 5.153284761430e+03 + 4.140000000000e+05-2.793967723850e-08 2.430319399420e+00-5.587935447690e-08 + 1.101927969300e+00 2.711875000000e+02-2.327579154250e+00-6.196329530570e-09 + -7.857470152310e-12 0.000000000000e+00 1.025000000000e+03 0.000000000000e+00 + 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 3.890000000000e+02 + 4.104000000000e+05 0.000000000000e+00 diff --git a/data/test_input_rinex2_nav_UnknownHeaderLabel.99n b/data/test_input_rinex2_nav_UnknownHeaderLabel.99n new file mode 100644 index 000000000..fbef79404 --- /dev/null +++ b/data/test_input_rinex2_nav_UnknownHeaderLabel.99n @@ -0,0 +1,9 @@ + 2.10 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + UNKNOWN LABEL + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex2_nav_UnsupportedRinex.99n b/data/test_input_rinex2_nav_UnsupportedRinex.99n new file mode 100644 index 000000000..fcdb7d0ec --- /dev/null +++ b/data/test_input_rinex2_nav_UnsupportedRinex.99n @@ -0,0 +1,8 @@ + 3.33 N : GPS NAV DATA RINEX VERSION / TYPE +XXRINEXN V3 AIUB 1999-09-02 19:22:36 PGM / RUN BY / DATE +EXAMPLE OF VERSION 2.10 FORMAT COMMENT + .1676D-07 .2235D-07 -.1192D-06 -.1192D-06 ION ALPHA + .1208D+06 .1310D+06 -.1310D+06 -.1966D+06 ION BETA + .133179128170D-06 .107469588780D-12 552960 1025 DELTA-UTC: A0,A1,T,W + 13 LEAP SECONDS + END OF HEADER diff --git a/data/test_input_rinex2_obs_BadEpochFlag.06o b/data/test_input_rinex2_obs_BadEpochFlag.06o new file mode 100644 index 000000000..c366f0da0 --- /dev/null +++ b/data/test_input_rinex2_obs_BadEpochFlag.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 12 0 0 0.0000000 9 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_BadEpochLine.06o b/data/test_input_rinex2_obs_BadEpochLine.06o new file mode 100644 index 000000000..145f3eddf --- /dev/null +++ b/data/test_input_rinex2_obs_BadEpochLine.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER +06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_BadLineSize.06o b/data/test_input_rinex2_obs_BadLineSize.06o new file mode 100644 index 000000000..91eaf25df --- /dev/null +++ b/data/test_input_rinex2_obs_BadLineSize.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 zzzzzzz + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_FilterTest1.06o b/data/test_input_rinex2_obs_FilterTest1.06o new file mode 100644 index 000000000..5f3aa9c23 --- /dev/null +++ b/data/test_input_rinex2_obs_FilterTest1.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/10/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 11 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 11 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS A SINGULAR COMMENT COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 11 1 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 11 1 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 11 1 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 11 1 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 11 1 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 11 1 2 31.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_FilterTest2.06o b/data/test_input_rinex2_obs_FilterTest2.06o new file mode 100644 index 000000000..2c759feda --- /dev/null +++ b/data/test_input_rinex2_obs_FilterTest2.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/10/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 11 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 11 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS A SECOND COMMENT COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 11 1 0 0.0000000 1 9G 1G 5G11G14G15G18G22G25G30 0.999999999 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 11 1 0 35.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 11 1 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 11 1 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 11 1 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 11 1 2 31.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_FilterTest3.06o b/data/test_input_rinex2_obs_FilterTest3.06o new file mode 100644 index 000000000..5f3aa9c23 --- /dev/null +++ b/data/test_input_rinex2_obs_FilterTest3.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/10/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 11 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 11 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS A SINGULAR COMMENT COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 11 1 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 11 1 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 11 1 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 11 1 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 11 1 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 11 1 2 31.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_FilterTest4.06o b/data/test_input_rinex2_obs_FilterTest4.06o new file mode 100644 index 000000000..5f3aa9c23 --- /dev/null +++ b/data/test_input_rinex2_obs_FilterTest4.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/10/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 11 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 11 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS A SINGULAR COMMENT COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 11 1 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 11 1 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 11 1 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 11 1 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 11 1 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 11 1 2 31.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_IncompleteHeader.06o b/data/test_input_rinex2_obs_IncompleteHeader.06o new file mode 100644 index 000000000..a62861e64 --- /dev/null +++ b/data/test_input_rinex2_obs_IncompleteHeader.06o @@ -0,0 +1,154 @@ + 2.10 Observation G (GPS) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +THIS IS MISSING A MARKER NAME COMMENT +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_InvalidLineLength.06o b/data/test_input_rinex2_obs_InvalidLineLength.06o new file mode 100644 index 000000000..86a3c64b4 --- /dev/null +++ b/data/test_input_rinex2_obs_InvalidLineLength.06o @@ -0,0 +1,155 @@ + 2.10 Observation G (GPS) RINEX VERSION / TYPEzzzzzzzzzzzzzzzzzzz +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_InvalidTimeFormat.06o b/data/test_input_rinex2_obs_InvalidTimeFormat.06o new file mode 100644 index 000000000..17c8965a3 --- /dev/null +++ b/data/test_input_rinex2_obs_InvalidTimeFormat.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 12000.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_NotObs.06o b/data/test_input_rinex2_obs_NotObs.06o new file mode 100644 index 000000000..fa964b2e5 --- /dev/null +++ b/data/test_input_rinex2_obs_NotObs.06o @@ -0,0 +1,155 @@ + 2.10 Dbservation G (GPS) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_RinexContData.06o b/data/test_input_rinex2_obs_RinexContData.06o new file mode 100644 index 000000000..b578e7ba6 --- /dev/null +++ b/data/test_input_rinex2_obs_RinexContData.06o @@ -0,0 +1,187 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 3 0.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +TEST COMMENT + 9 # OF SATELLITES + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 12 0 0 0.0000000 0 13G 1G 2G 3G 4G 5G 6G 7G 8G 9G10G11G12 .00001 + G15 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + 3 1 +85408 MARKER NAME +85408 MARKER NUMBER +THIS IS THE START OF A NEW SITE COMMENT + 06 4 12 0 3 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 +THIS IS THE START OF A COMMENT COMMENT \ No newline at end of file diff --git a/data/test_input_rinex2_obs_RinexObsFile.06o b/data/test_input_rinex2_obs_RinexObsFile.06o new file mode 100644 index 000000000..cdb8c4daf --- /dev/null +++ b/data/test_input_rinex2_obs_RinexObsFile.06o @@ -0,0 +1,154 @@ + 2.10 Observation S (Geosync) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +85408 MARKER NAME +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G01 G05 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 GPS TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 GPS TIME OF LAST OBS +85408 MARKER NUMBER + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT + 9 # OF SATELLITES + G01 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G05 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G01G05G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 diff --git a/data/test_input_rinex2_obs_SystemGeosync.06o b/data/test_input_rinex2_obs_SystemGeosync.06o new file mode 100644 index 000000000..9c4c0c1f3 --- /dev/null +++ b/data/test_input_rinex2_obs_SystemGeosync.06o @@ -0,0 +1,155 @@ + 2.10 Observation S (GEOSYNC) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_SystemGlonass.06o b/data/test_input_rinex2_obs_SystemGlonass.06o new file mode 100644 index 000000000..62480309b --- /dev/null +++ b/data/test_input_rinex2_obs_SystemGlonass.06o @@ -0,0 +1,155 @@ + 2.10 Observation R (GLONASS) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_SystemMixed.06o b/data/test_input_rinex2_obs_SystemMixed.06o new file mode 100644 index 000000000..cef672f5d --- /dev/null +++ b/data/test_input_rinex2_obs_SystemMixed.06o @@ -0,0 +1,155 @@ + 2.10 Observation M (MIXED) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_SystemTransit.06o b/data/test_input_rinex2_obs_SystemTransit.06o new file mode 100644 index 000000000..a3981ed0b --- /dev/null +++ b/data/test_input_rinex2_obs_SystemTransit.06o @@ -0,0 +1,155 @@ + 2.10 Observation T (TRANSIT) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex2_obs_UnSupVersion.06o b/data/test_input_rinex2_obs_UnSupVersion.06o new file mode 100644 index 000000000..021432e5e --- /dev/null +++ b/data/test_input_rinex2_obs_UnSupVersion.06o @@ -0,0 +1,155 @@ + 3.33 Observation G (GPS) RINEX VERSION / TYPE +row Dataflow Processing 04/11/2006 23:59:18 PGM / RUN BY / DATE +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +85408 MARKER NAME +85408 MARKER NUMBER +Monitor Station NGA OBSERVER / AGENCY +1 ZY12 REC # / TYPE / VERS +85408 AshTech Geodetic 3 ANT # / TYPE + -740289.8540 -5457071.7398 3207245.6036 APPROX POSITION XYZ + 0.0000 0.0000 0.0000 ANTENNA: DELTA H/E/N + 1 1 WAVELENGTH FACT L1/2 + 1 1 7 G 1 G 5 G11 G14 G15 G18 G22WAVELENGTH FACT L1/2 + 1 1 2 G25 G30 WAVELENGTH FACT L1/2 + 10 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV + C2 # / TYPES OF OBSERV + 30.000 INTERVAL + 2006 4 12 0 0 0.0000000 TIME OF FIRST OBS + 2006 4 12 0 2 30.0000000 TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL + 0 LEAP SECONDS + G 1 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G 5 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G11 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G14 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G15 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G18 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G22 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G25 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + G30 6 6 6 6 6 6 6 6 6PRN / # OF OBS + 6 PRN / # OF OBS + 9 # OF SATELLITES + END OF HEADER + 06 4 12 0 0 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20513506.842 8 -15969234.484 8 21665483.802 21665483.747 21665487.640 + 515.647 401.788 47.700 46.660 21665483.802 + -3691532.645 7 -2863805.580 7 24634539.994 24634539.174 24634543.837 + -1216.308 -947.775 36.590 36.930 24634539.994 + -7057436.241 8 -4901768.167 7 23694610.336 23694609.550 23694613.033 + 1217.015 948.313 40.760 39.710 23694610.336 + -16343346.682 8 -12699359.265 8 21708740.245 21708739.454 21708742.382 + -1151.786 -897.508 47.010 45.970 21708740.245 + -1602460.157 7 -1232616.532 7 25004772.834 25004773.533 25004782.498 + -3880.782 -3024.013 33.110 34.850 25004772.834 + -4088479.235 7 -3162287.536 7 24665341.073 24665339.854 24665345.025 + -2893.118 -2254.398 39.020 37.980 24665341.073 + -17124342.986 8 -13331159.394 8 21681948.619 21681948.968 21681950.410 + -1459.891 -1137.590 47.360 46.660 21681948.619 + -22955985.940 8 -17859781.456 8 21053362.259 21053362.337 21053366.250 + 1391.814 1084.512 49.790 49.440 21053362.259 + -2546302.283 8 -1978515.606 7 23330767.487 23330767.964 23330771.128 + 540.480 421.120 41.450 39.020 23330767.487 + 06 4 12 0 0 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20528906.247 8 -15981234.023 8 21662553.649 21662553.318 21662557.419 + 510.757 397.957 48.050 46.660 21662553.649 + -3654799.189 7 -2835182.134 7 24641529.882 24641528.795 24641534.784 + -1232.999 -960.818 36.590 37.980 24641529.882 + -7093714.565 8 -4930036.987 8 23687705.910 23687706.091 23687710.145 + 1201.272 936.026 40.760 40.060 23687705.910 + -16308749.700 8 -12672400.596 8 21715323.570 21715323.076 21715326.263 + -1154.895 -899.946 47.010 45.970 21715323.570 + -1486070.551 7 -1141923.487 7 25026922.306 25026922.303 25026930.890 + -3878.640 -3022.334 33.110 35.200 25026922.306 + -4001584.245 7 -3094577.243 7 24681876.142 24681875.352 24681880.668 + -2900.093 -2259.850 38.670 37.980 24681876.142 + -17080375.343 8 -13296898.924 8 21690315.746 21690315.856 21690317.259 + -1471.516 -1146.672 47.360 46.660 21690315.746 + -22997506.359 8 -17892135.009 8 21045461.079 21045461.050 21045465.088 + 1375.958 1072.138 49.440 49.090 21045461.079 + -2562267.423 8 -1990955.948 7 23327728.381 23327729.439 23327732.813 + 523.500 407.881 41.450 39.020 23327728.381 + 06 4 12 0 1 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20544158.920 8 -15993119.225 8 21659651.382 21659650.826 21659655.019 + 505.903 394.202 47.700 46.660 21659651.382 + -3617561.441 7 -2806165.708 7 24648614.555 24648614.710 24648621.002 + -1249.821 -973.902 36.240 38.320 24648614.555 + -7129519.808 8 -4957937.178 8 23680892.696 23680892.535 23680896.704 + 1185.538 923.786 40.760 40.060 23680892.696 + -16274058.039 8 -12645368.153 8 21721925.004 21721924.643 21721927.820 + -1158.031 -902.369 47.010 45.620 21721925.004 + -1369745.199 7 -1051280.465 7 25049059.530 25049058.774 25049067.448 + -3876.428 -3020.616 33.110 34.150 25049059.530 + -3914479.816 7 -3026703.725 7 24698451.409 24698450.045 24698456.546 + -2907.025 -2265.234 38.320 36.930 24698451.409 + -17036057.604 8 -13262365.655 8 21698749.582 21698749.410 21698750.877 + -1483.193 -1155.742 47.360 46.310 21698749.582 + -23038550.108 8 -17924117.135 8 21037650.766 21037650.887 21037654.749 + 1360.109 1059.812 49.440 49.090 21037650.766 + -2577720.487 8 -2002997.295 7 23324786.889 23324787.896 23324792.026 + 506.394 394.588 41.100 39.370 23324786.889 + 06 4 12 0 1 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20559266.011 8 -16004890.977 8 21656776.269 21656776.043 21656780.241 + 501.124 390.481 47.700 47.010 21656776.269 + -3579820.440 7 -2776757.146 7 24655796.630 24655796.085 24655802.794 + -1266.574 -986.938 36.240 37.280 24655796.630 + -7164851.352 8 -4985468.239 7 23674168.806 23674168.943 23674172.803 + 1169.740 911.479 40.760 39.710 23674168.806 + -16239272.837 8 -12618262.809 8 21728544.230 21728543.570 21728547.028 + -1161.091 -904.753 46.660 45.620 21728544.230 + -1253486.654 7 -960689.528 7 25071183.787 25071182.159 25071190.255 + -3874.170 -3018.822 32.760 34.500 25071183.787 + -3827166.892 7 -2958667.741 7 24715066.181 24715065.656 24715071.041 + -2913.944 -2270.614 37.980 36.930 24715066.181 + -16991389.684 8 -13227559.510 8 21707249.089 21707249.340 21707251.192 + -1494.849 -1164.823 47.360 46.310 21707249.089 + -23079117.223 8 -17955727.848 8 21029931.273 21029931.370 21029934.650 + 1344.238 1047.451 49.440 49.090 21029931.273 + -2592660.701 8 -2014639.005 7 23321945.296 23321945.420 23321949.502 + 489.309 381.262 41.100 39.370 23321945.296 + 06 4 12 0 2 0.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20574228.477 8 -16016550.042 8 21653929.251 21653928.898 21653933.057 + 496.342 386.787 47.700 47.010 21653929.251 + -3541576.978 7 -2746957.029 7 24663074.532 24663073.983 24663080.434 + -1283.188 -999.854 36.930 37.280 24663074.532 + -7199708.599 8 -5012629.719 8 23667536.169 23667536.012 23667540.075 + 1154.015 899.256 41.100 40.060 23667536.169 + -16204394.833 8 -12591085.158 8 21735181.389 21735180.796 21735184.068 + -1164.149 -907.104 46.660 45.620 21735181.389 + -1137297.716 7 -870152.831 7 25093291.702 25093290.810 25093301.091 + -3871.651 -3016.857 32.760 33.810 25093291.702 + -3739646.561 7 -2890470.164 7 24731720.038 24731720.235 24731725.819 + -2920.754 -2275.892 36.930 35.890 24731720.038 + -16946371.781 8 -13192480.667 8 21715815.749 21715815.880 21715817.425 + -1506.436 -1173.822 47.360 46.310 21715815.749 + -23119207.429 8 -17986966.948 8 21022301.955 21022302.206 21022306.100 + 1328.361 1035.115 49.440 49.090 21022301.955 + -2607086.229 8 -2025879.658 7 23319200.070 23319200.218 23319205.231 + 472.200 367.974 41.450 39.710 23319200.070 + 06 4 12 0 2 30.0000000 0 9G 1G 5G11G14G15G18G22G25G30 + -20589046.539 8 -16028096.570 8 21651109.307 21651109.020 21651113.522 + 491.614 383.071 47.700 47.010 21651109.307 + -3502831.312 7 -2716765.608 7 24670448.169 24670447.826 24670453.727 + -1299.896 -1012.912 37.280 37.280 24670448.169 + -7234090.432 8 -5039420.751 8 23660993.890 23660993.628 23660997.651 + 1138.213 886.917 41.450 40.060 23660993.890 + -16169423.829 8 -12563835.033 8 21741835.771 21741835.937 21741838.437 + -1167.164 -909.479 46.660 45.620 21741835.771 + -1021180.696 7 -779672.124 7 25115389.226 25115387.725 25115396.334 + -3869.292 -3015.039 32.070 31.720 25115389.226 + -3651919.231 7 -2822111.265 7 24748412.491 24748413.252 24748420.069 + -2927.520 -2281.178 35.200 34.500 24748412.491 + -16901003.086 8 -13157128.449 8 21724449.614 21724449.481 21724451.284 + -1518.061 -1182.907 47.360 46.310 21724449.614 + -23158819.964 8 -18017833.826 8 21014764.059 21014763.996 21014767.782 + 1312.522 1022.742 49.440 49.090 21014764.059 + -2620995.320 8 -2036717.878 7 23316553.121 23316552.816 23316557.199 + 455.015 354.529 41.450 39.370 23316553.121 + diff --git a/data/test_input_rinex3_clock_BadEpochLine.96c b/data/test_input_rinex3_clock_BadEpochLine.96c new file mode 100644 index 000000000..e57279111 --- /dev/null +++ b/data/test_input_rinex3_clock_BadEpochLine.96c @@ -0,0 +1,34 @@ + 3.00 CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +ARAREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 \ No newline at end of file diff --git a/data/test_input_rinex3_clock_IncompleteHeader.96c b/data/test_input_rinex3_clock_IncompleteHeader.96c new file mode 100644 index 000000000..07d0a5102 --- /dev/null +++ b/data/test_input_rinex3_clock_IncompleteHeader.96c @@ -0,0 +1,25 @@ + 3.00 CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER diff --git a/data/test_input_rinex3_clock_InvalidLineLength.96c b/data/test_input_rinex3_clock_InvalidLineLength.96c new file mode 100644 index 000000000..d9187ea5a --- /dev/null +++ b/data/test_input_rinex3_clock_InvalidLineLength.96c @@ -0,0 +1,34 @@ + 3.00 CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS zzzzzzzzzzzzzzzz +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 \ No newline at end of file diff --git a/data/test_input_rinex3_clock_NotAClockFile.96c b/data/test_input_rinex3_clock_NotAClockFile.96c new file mode 100644 index 000000000..1fb9d229c --- /dev/null +++ b/data/test_input_rinex3_clock_NotAClockFile.96c @@ -0,0 +1,34 @@ + 3.00 NOT CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 \ No newline at end of file diff --git a/data/test_input_rinex3_clock_RinexClockExample.96c b/data/test_input_rinex3_clock_RinexClockExample.96c new file mode 100644 index 000000000..45f5142dd --- /dev/null +++ b/data/test_input_rinex3_clock_RinexClockExample.96c @@ -0,0 +1,34 @@ + 3.00 CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 \ No newline at end of file diff --git a/data/test_input_rinex3_clock_UnknownHeaderLabel.96c b/data/test_input_rinex3_clock_UnknownHeaderLabel.96c new file mode 100644 index 000000000..28bfea3d5 --- /dev/null +++ b/data/test_input_rinex3_clock_UnknownHeaderLabel.96c @@ -0,0 +1,35 @@ + 3.00 CLOCK DATA GPS RINEX VERSION / TYPE +TORINEXC V9.9 USNO 19960403 001000 UTC PGM / RUN BY / DATE +EXAMPLE OF A CLOCK DATA ANALYSIS FILE COMMENT +IN THIS CASE ANALYSIS RESULTS FROM GPS ONLY ARE INCLUDED COMMENT +No re-alignment of the clocks has been applied. COMMENT +G 4 C1W L1W C2W L2W SYS / # / OBS TYPES + GPS TIME SYSTEM ID + 10 LEAP SECONDS +G CC2NONCC p1c1bias.hist @ goby.nrl.navy.mil SYS / DCBS APPLIED +G PAGES igs05.atx @ igscb.jpl.nasa.gov SYS / PCVS APPLIED + 2 AS AR # / TYPES OF DATA +USN USNO USING GIPSY/OASIS-II ANALYSIS CENTER + 1 1994 07 14 0 0 0.000000 1994 07 14 20 59 0.000000# OF CLK REF +USNO 40451S003 -.123456789012E+00 ANALYSIS CLK REF + 1 1994 07 14 21 0 0.000000 1994 07 14 21 59 0.000000# OF CLK REF +TIDB 50103M108 -0.123456789012E+00 ANALYSIS CLK REF + 4 ITRF96 # OF SOLN STA / TRF +GOLD 40405S031 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM +AREQ 42202M005 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +TIDB 50103M108 1234567890 -1234567890 1234567890SOLN STA NAME / NUM +HARK 30302M007 -1234567890 1234567890 -1234567890SOLN STA NAME / NUM +USNO 40451S003 1234567890 -1234567890 -1234567890SOLN STA NAME / NUM + 27 # OF SOLN SATS +G01 G02 G03 G04 G05 G06 G07 G08 G09 G10 G13 G14 G15 G16 G17 PRN LIST +G18 G19 G21 G22 G23 G24 G25 G26 G27 G29 G30 G31 PRN LIST + NOT A LABEL + END OF HEADER +AR AREQ 1994 07 14 20 59 0.000000 6 -0.123456789012E+00 -0.123456789012E+01 +-0.123456789012E+02 -0.123456789012E+03 -0.123456789012E+04 -0.123456789012E+05 +AS G16 1994 07 14 20 59 0.000000 2 -.123456789012E+00 -.123456789012E-01 +AR GOLD 1994 07 14 20 59 0.000000 4 -.123456789012E-01 -.123456789012E-02 + -.123456789012E-03 -.123456789012E-04 +AR HARK 1994 07 14 20 59 0.000000 2 .123456789012E+00 .123456789012E+00 +AR TIDB 1994 07 14 20 59 0.000000 6 .123456789012E+00 .123456789012E+00 + .123456789012E+00 .123456789012E+00 .123456789012E+00 .123456789012E+00 \ No newline at end of file diff --git a/data/test_input_rinex3_nav_BadHeader.15n b/data/test_input_rinex3_nav_BadHeader.15n new file mode 100644 index 000000000..fe8402777 --- /dev/null +++ b/data/test_input_rinex3_nav_BadHeader.15n @@ -0,0 +1,24 @@ + 3.33 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER +G 5 2014 10 31 22 00 00-0.323241576552D-03 0.432009983342D-11 0.000000000000D+00 + 0.460000000000D+02 0.450625000000D+02 0.515592905085D-08 0.232336866828D+01 + 0.239349901676D-05 0.393592659384D-02 0.857748091221D-05 0.515370770454D+04 + 0.511200000000D+06-0.726431608200D-07 0.286556080156D+01 0.558793544769D-08 + 0.947181540862D+00 0.207687500000D+03 0.378986032872D+00-0.829105964163D-08 + 0.306798493674D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.107102096081D-07 0.460000000000D+02 + 0.504018000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 +G15 2014 10 31 21 59 44-0.211907085031D-03-0.227373675443D-11 0.000000000000D+00 + 0.100000000000D+01 0.650000000000D+01 0.553523056457D-08 0.735133045745D+00 + 0.512227416039D-06 0.676390877925D-02 0.558421015739D-05 0.515378810883D+04 + 0.511184000000D+06 0.484287738800D-07-0.240708821497D+01 0.931322574615D-07 + 0.935325779182D+00 0.254187500000D+03 0.297749903736D+00-0.869429072354D-08 + -0.385016037463D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.102445483208D-07 0.100000000000D+01 + 0.504078000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 diff --git a/data/test_input_rinex3_nav_FilterTest1.15n b/data/test_input_rinex3_nav_FilterTest1.15n new file mode 100644 index 000000000..91abe831d --- /dev/null +++ b/data/test_input_rinex3_nav_FilterTest1.15n @@ -0,0 +1,24 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +THIS IS A COMMENT COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER +G 5 2014 10 31 22 00 00-0.323241576552D-03 0.432009983342D-11 0.000000000000D+00 + 0.460000000000D+02 0.450625000000D+02 0.515592905085D-08 0.232336866828D+01 + 0.239349901676D-05 0.393592659384D-02 0.857748091221D-05 0.515370770454D+04 + 0.511200000000D+06-0.726431608200D-07 0.286556080156D+01 0.558793544769D-08 + 0.947181540862D+00 0.207687500000D+03 0.378986032872D+00-0.829105964163D-08 + 0.306798493674D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.107102096081D-07 0.460000000000D+02 + 0.504018000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 +G15 2014 10 31 21 59 44-0.211907085031D-03-0.227373675443D-11 0.000000000000D+00 + 0.100000000000D+01 0.650000000000D+01 0.553523056457D-08 0.735133045745D+00 + 0.512227416039D-06 0.676390877925D-02 0.558421015739D-05 0.515378810883D+04 + 0.511184000000D+06 0.484287738800D-07-0.240708821497D+01 0.931322574615D-07 + 0.935325779182D+00 0.254187500000D+03 0.297749903736D+00-0.869429072354D-08 + -0.385016037463D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.102445483208D-07 0.100000000000D+01 + 0.504078000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 diff --git a/data/test_input_rinex3_nav_FilterTest2.15n b/data/test_input_rinex3_nav_FilterTest2.15n new file mode 100644 index 000000000..9d7831ab5 --- /dev/null +++ b/data/test_input_rinex3_nav_FilterTest2.15n @@ -0,0 +1,24 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +THIS IS A DIFFERENT COMMENT COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER +G 5 2014 10 31 22 00 00-0.323241576552D-03 0.432009983342D-11 0.000000000000D+00 + 0.460000000000D+02 0.450625000000D+02 0.515592905085D-08 0.232336866828D+01 + 0.239349901676D-05 0.393592659384D-02 0.857748091221D-05 0.515370770454D+04 + 0.511200000000D+06-0.726431608200D-07 0.286556080156D+01 0.558793544769D-08 + 0.947181540862D+00 0.207687500000D+03 0.378986032872D+00-0.829105964163D-08 + 0.306798493674D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.107102096081D-07 0.460000000000D+02 + 0.504018000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 +G15 2014 10 31 21 59 44-0.211907085031D-03-0.227373675443D-11 0.000000000000D+00 + 0.100000000000D+01 0.650000000000D+01 0.553523056457D-08 0.735133045745D+00 + 0.512227416039D-06 0.676390877925D-02 0.558421015739D-05 0.515378810883D+04 + 0.511184000000D+06 0.484287738800D-07-0.240708821497D+01 0.931322574615D-07 + 0.935325779182D+00 0.254187500000D+03 0.297749903736D+00-0.869429072354D-08 + -0.385016037463D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.102445483208D-07 0.100000000000D+01 + 0.504078000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 diff --git a/data/test_input_rinex3_nav_FilterTest3.15n b/data/test_input_rinex3_nav_FilterTest3.15n new file mode 100644 index 000000000..8e0ff3926 --- /dev/null +++ b/data/test_input_rinex3_nav_FilterTest3.15n @@ -0,0 +1,24 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +EXAMPLE OF RINEX 3.02 COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER +G 5 2014 10 31 22 00 44-0.323241576552D-03 0.432009983342D-11 0.000000000000D+00 + 0.460000000000D+02 0.450625000000D+02 0.515592905085D-08 0.232336866828D+01 + 0.239349901676D-05 0.393592659384D-02 0.857748091221D-05 0.515370770454D+04 + 0.511200000000D+06-0.726431608200D-07 0.286556080156D+01 0.558793544769D-08 + 0.947181540862D+00 0.207687500000D+03 0.378986032872D+00-0.829105964163D-08 + 0.306798493674D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.107102096081D-07 0.460000000000D+02 + 0.504018000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 +G15 2014 10 31 21 00 00-0.211907085031D-03-0.227373675443D-11 0.000000000000D+00 + 0.100000000000D+01 0.650000000000D+01 0.553523056457D-08 0.735133045745D+00 + 0.512227416039D-06 0.676390877925D-02 0.558421015739D-05 0.515378810883D+04 + 0.511184000000D+06 0.484287738800D-07-0.240708821497D+01 0.931322574615D-07 + 0.935325779182D+00 0.254187500000D+03 0.297749903736D+00-0.869429072354D-08 + -0.385016037463D-09 0.100000000000D+01 0.181600000000D+04 0.000000000000D+00 + 0.240000000000D+01 0.000000000000D+00-0.102445483208D-07 0.100000000000D+01 + 0.504078000000D+06 0.400000000000D+01 0.000000000000D+00 0.000000000000D+00 diff --git a/data/test_input_rinex3_nav_IncompleteHeader.15n b/data/test_input_rinex3_nav_IncompleteHeader.15n new file mode 100644 index 000000000..a5fa4c250 --- /dev/null +++ b/data/test_input_rinex3_nav_IncompleteHeader.15n @@ -0,0 +1,7 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex3_nav_InvalidLineLength.15n b/data/test_input_rinex3_nav_InvalidLineLength.15n new file mode 100644 index 000000000..d2ec583ea --- /dev/null +++ b/data/test_input_rinex3_nav_InvalidLineLength.15n @@ -0,0 +1,8 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPEEEEEEEEE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex3_nav_NotaNavFile.15n b/data/test_input_rinex3_nav_NotaNavFile.15n new file mode 100644 index 000000000..3be848f5f --- /dev/null +++ b/data/test_input_rinex3_nav_NotaNavFile.15n @@ -0,0 +1,8 @@ + 3.02 Z: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex3_nav_RinexNavExample.15n b/data/test_input_rinex3_nav_RinexNavExample.15n new file mode 100644 index 000000000..e36ca4cfb --- /dev/null +++ b/data/test_input_rinex3_nav_RinexNavExample.15n @@ -0,0 +1,112 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 2.7940e-08 -7.4510e-09 -1.1920e-07 1.1920e-07 IONOSPHERIC CORR +GPSB 1.3720e+05 -4.9150e+04 -1.3110e+05 -2.6210e+05 IONOSPHERIC CORR +GPUT 1.8626451490e-09 4.440892100e-15 61440 25 0 TIME SYSTEM CORR + 16 0 0 0 LEAP SECONDS + END OF HEADER +G05 2014 10 31 22 00 00-3.232415765520e-04 4.320099833420e-12 0.000000000000e+00 + 4.600000000000e+01 4.506250000000e+01 5.155929050850e-09 2.323368668280e+00 + 2.393499016760e-06 3.935926593840e-03 8.577480912210e-06 5.153707704540e+03 + 5.112000000000e+05-7.264316082000e-08 2.865560801560e+00 5.587935447690e-09 + 9.471815408620e-01 2.076875000000e+02 3.789860328720e-01-8.291059641630e-09 + 3.067984936740e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.071020960810e-08 4.600000000000e+01 + 5.040180000000e+05 4.000000000000e+00 +G15 2014 10 31 21 59 44-2.119070850310e-04-2.273736754430e-12 0.000000000000e+00 + 1.000000000000e+00 6.500000000000e+00 5.535230564570e-09 7.351330457450e-01 + 5.122274160390e-07 6.763908779250e-03 5.584210157390e-06 5.153788108830e+03 + 5.111840000000e+05 4.842877388000e-08-2.407088214970e+00 9.313225746150e-08 + 9.353257791820e-01 2.541875000000e+02 2.977499037360e-01-8.694290723540e-09 + -3.850160374630e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.024454832080e-08 1.000000000000e+00 + 5.040780000000e+05 4.000000000000e+00 +G26 2014 10 31 22 00 00-1.074257306750e-04-1.296029950030e-11 0.000000000000e+00 + 7.900000000000e+01 5.531250000000e+00 4.656622538450e-09 2.542196015640e-01 + 4.563480615620e-07 2.128368557900e-02 7.109716534610e-06 5.153680982590e+03 + 5.112000000000e+05-2.495944499970e-07-2.266183627740e+00 1.043081283570e-07 + 9.734673699430e-01 2.516875000000e+02 1.296012920280e+00-8.526069430730e-09 + -4.428755904030e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-6.519258022310e-09 7.900000000000e+01 + 5.047260000000e+05 4.000000000000e+00 +G29 2014 10 31 21 59 44 5.702753551300e-04 2.387423592150e-12 0.000000000000e+00 + 1.400000000000e+01-6.690625000000e+01 4.462328731050e-09-2.024554475550e+00 + -3.432855010030e-06 1.115676481280e-03 5.349516868590e-06 5.153609638210e+03 + 5.111840000000e+05 1.303851604460e-08 8.289098601770e-01 6.519258022310e-08 + 9.709542010310e-01 2.813125000000e+02-8.433246751950e-01-8.258201130080e-09 + -6.285976121850e-11 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-9.778887033460e-09 1.400000000000e+01 + 5.046960000000e+05 4.000000000000e+00 +G18 2014 10 31 22 00 00 3.551696427170e-04 2.614797267600e-12 0.000000000000e+00 + 5.400000000000e+01 4.521875000000e+01 5.438440818600e-09 3.044056132380e+00 + 2.255663275720e-06 1.548216945960e-02 8.324161171910e-06 5.153738719940e+03 + 5.112000000000e+05 1.285225152970e-07 2.856899736980e+00-2.831220626830e-07 + 9.257353329810e-01 1.967187500000e+02-2.006117425790e+00-8.249629344460e-09 + 2.707255625210e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.117587089540e-08 5.400000000000e+01 + 5.041020000000e+05 4.000000000000e+00 +G15 2014 11 01 00 00 00-2.119229175150e-04-2.273736754430e-12 0.000000000000e+00 + 2.000000000000e+00 8.531250000000e+00 5.550945504880e-09 1.787426337550e+00 + 6.128102540970e-07 6.764378515070e-03 6.278976798060e-06 5.153790311810e+03 + 5.184000000000e+05-6.146728992460e-08-2.407151385230e+00 2.048909664150e-07 + 9.353232454070e-01 2.460312500000e+02 2.979080305510e-01-8.663218000660e-09 + -2.878691337620e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.024454832080e-08 2.000000000000e+00 + 5.112180000000e+05 4.000000000000e+00 +G29 2014 10 31 23 59 44 5.702925845980e-04 2.387423592150e-12 0.000000000000e+00 + 1.500000000000e+01-6.550000000000e+01 4.463043046510e-09-9.741560839800e-01 + -3.283843398090e-06 1.116007682870e-03 5.600973963740e-06 5.153610063550e+03 + 5.183840000000e+05-4.656612873080e-08 8.288505988290e-01 6.146728992460e-08 + 9.709537387490e-01 2.765625000000e+02-8.435032053290e-01-8.238557454700e-09 + -9.428964182780e-11 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-9.778887033460e-09 1.500000000000e+01 + 5.118780000000e+05 4.000000000000e+00 +G22 2014 11 01 00 00 00 2.824971452360e-04 3.524291969370e-12 0.000000000000e+00 + 8.200000000000e+01 4.746875000000e+01 5.533444775900e-09-2.721346757160e+00 + 2.320855855940e-06 7.313982816410e-03 8.540228009220e-06 5.153718420030e+03 + 5.184000000000e+05 1.545995473860e-07 2.858419378240e+00-8.568167686460e-08 + 9.235312874370e-01 1.935937500000e+02-2.058636492050e+00-8.439637259050e-09 + 3.753727786400e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 3.400000000000e+00 0.000000000000e+00-1.769512891770e-08 8.200000000000e+01 + 5.130480000000e+05 4.000000000000e+00 +G21 2014 10 31 22 00 00-3.924034535880e-04-2.046363078990e-12 0.000000000000e+00 + 5.000000000000e+01-6.021875000000e+01 4.891989485280e-09-2.282664437110e+00 + -3.270804882050e-06 2.172262384560e-02 1.046806573870e-05 5.153676761630e+03 + 5.112000000000e+05 2.924352884290e-07 1.812568605030e+00-3.166496753690e-08 + 9.326542947380e-01 1.531875000000e+02-1.983308974930e+00-7.905686446430e-09 + 2.428672592530e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.164153218270e-08 5.000000000000e+01 + 5.040180000000e+05 4.000000000000e+00 +G21 2014 11 01 00 00 00-3.924183547500e-04-2.046363078990e-12 0.000000000000e+00 + 5.100000000000e+01-4.459375000000e+01 5.078782980270e-09-1.232584094170e+00 + -1.940876245500e-06 2.172305376730e-02 1.100637018680e-05 5.153672489170e+03 + 5.184000000000e+05 3.054738044740e-07 1.812512039840e+00 5.252659320830e-07 + 9.326537329770e-01 1.477500000000e+02-1.983206779860e+00-8.348204879100e-09 + 3.785871982480e-11 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.164153218270e-08 5.100000000000e+01 + 5.145480000000e+05 4.000000000000e+00 +G18 2014 11 01 00 00 00 3.551882691680e-04 2.614797267600e-12 0.000000000000e+00 + 5.500000000000e+01 4.996875000000e+01 5.452012812500e-09-2.189012182840e+00 + 2.518296241760e-06 1.548244047440e-02 8.080154657360e-06 5.153737903590e+03 + 5.184000000000e+05 2.328306436540e-07 2.856839101950e+00-3.352761268620e-08 + 9.257380788780e-01 2.001250000000e+02-2.006086053510e+00-8.278916278670e-09 + 4.710910514050e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00-1.117587089540e-08 5.500000000000e+01 + 5.165760000000e+05 4.000000000000e+00 +G27 2014 11 01 00 00 00 2.647610381250e-05 2.842170943040e-12 0.000000000000e+00 + 8.400000000000e+01-5.387500000000e+01 4.614835083550e-09 2.462028894870e+00 + -2.786517143250e-06 1.537257339810e-03 4.692003130910e-06 5.153680000310e+03 + 5.184000000000e+05 6.146728992460e-08 7.731517323700e-01 2.421438694000e-08 + 9.650225480570e-01 2.906875000000e+02 3.082945177730e-01-8.323918153170e-09 + -5.643092200300e-11 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00 1.396983861920e-09 8.400000000000e+01 + 5.182080000000e+05 4.000000000000e+00 +G24 2014 11 01 00 00 00-3.773532807830e-05-5.684341886080e-13 0.000000000000e+00 + 7.700000000000e+01 2.375000000000e+01 4.562690054350e-09 7.094098608080e-01 + 1.225620508190e-06 2.428175415840e-03 9.760260581970e-06 5.153709716800e+03 + 5.184000000000e+05 2.421438694000e-08-1.330713852060e+00-7.450580596920e-09 + 9.552706132550e-01 1.842812500000e+02 2.070581933530e-01-8.178554955360e-09 + -3.235849071820e-10 1.000000000000e+00 1.816000000000e+03 0.000000000000e+00 + 2.400000000000e+00 0.000000000000e+00 2.793967723850e-09 7.700000000000e+01 + 5.182620000000e+05 4.000000000000e+00 diff --git a/data/test_input_rinex3_nav_UnknownHeaderLabel.15n b/data/test_input_rinex3_nav_UnknownHeaderLabel.15n new file mode 100644 index 000000000..df75ae0d6 --- /dev/null +++ b/data/test_input_rinex3_nav_UnknownHeaderLabel.15n @@ -0,0 +1,9 @@ + 3.02 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + UNKNOWN LABEL + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex3_nav_UnsupportedRinex.15n b/data/test_input_rinex3_nav_UnsupportedRinex.15n new file mode 100644 index 000000000..6bc515114 --- /dev/null +++ b/data/test_input_rinex3_nav_UnsupportedRinex.15n @@ -0,0 +1,8 @@ + 3.33 N: GNSS NAV DATA G: GPS RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +GPSA 0.2794D-07 -0.7451D-08 -0.1192D-06 0.1192D-06 IONOSPHERIC CORR +GPSB 0.1372D+06 -0.4915D+05 -0.1311D+06 -0.2621D+06 IONOSPHERIC CORR +GPUT 0.1862645149D-08 0.444089210D-14 61440 25 TIME SYSTEM CORR + 16 LEAP SECONDS + END OF HEADER \ No newline at end of file diff --git a/data/test_input_rinex3_obs_BadEpochFlag.15o b/data/test_input_rinex3_obs_BadEpochFlag.15o new file mode 100644 index 000000000..e0d5487c0 --- /dev/null +++ b/data/test_input_rinex3_obs_BadEpochFlag.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 9 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_BadLineSize.15o b/data/test_input_rinex3_obs_BadLineSize.15o new file mode 100644 index 000000000..daaae70c8 --- /dev/null +++ b/data/test_input_rinex3_obs_BadLineSize.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 zzzzzzzzzzz +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_FilterTest1.15o b/data/test_input_rinex3_obs_FilterTest1.15o new file mode 100644 index 000000000..b3990aca6 --- /dev/null +++ b/data/test_input_rinex3_obs_FilterTest1.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA S (GEOSYNC) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_FilterTest2.15o b/data/test_input_rinex3_obs_FilterTest2.15o new file mode 100644 index 000000000..f0eeab9d4 --- /dev/null +++ b/data/test_input_rinex3_obs_FilterTest2.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 1 2 0.999999999 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_FilterTest3.15o b/data/test_input_rinex3_obs_FilterTest3.15o new file mode 100644 index 000000000..b3990aca6 --- /dev/null +++ b/data/test_input_rinex3_obs_FilterTest3.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA S (GEOSYNC) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_FilterTest4.15o b/data/test_input_rinex3_obs_FilterTest4.15o new file mode 100644 index 000000000..b3990aca6 --- /dev/null +++ b/data/test_input_rinex3_obs_FilterTest4.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA S (GEOSYNC) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_IncompleteHeader.15o b/data/test_input_rinex3_obs_IncompleteHeader.15o new file mode 100644 index 000000000..23f7af3ee --- /dev/null +++ b/data/test_input_rinex3_obs_IncompleteHeader.15o @@ -0,0 +1,152 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +THIS IS AN EXAMPLE RINEX OBS FILE COMMENT +THIS IS MISSING A MARKER NAME COMMENT +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_InvalidLineLength.15o b/data/test_input_rinex3_obs_InvalidLineLength.15o new file mode 100644 index 000000000..a79a1684f --- /dev/null +++ b/data/test_input_rinex3_obs_InvalidLineLength.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPEzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_InvalidTimeFormat.15o b/data/test_input_rinex3_obs_InvalidTimeFormat.15o new file mode 100644 index 000000000..0b9cbb88c --- /dev/null +++ b/data/test_input_rinex3_obs_InvalidTimeFormat.15o @@ -0,0 +1,143 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 310000.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 diff --git a/data/test_input_rinex3_obs_NotObs.15o b/data/test_input_rinex3_obs_NotObs.15o new file mode 100644 index 000000000..df18549e3 --- /dev/null +++ b/data/test_input_rinex3_obs_NotObs.15o @@ -0,0 +1,154 @@ + 3.02 DBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_RinexObsFile.15o b/data/test_input_rinex3_obs_RinexObsFile.15o new file mode 100644 index 000000000..7f7f4d934 --- /dev/null +++ b/data/test_input_rinex3_obs_RinexObsFile.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA GPS(GPS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_SystemGeosync.15o b/data/test_input_rinex3_obs_SystemGeosync.15o new file mode 100644 index 000000000..b3990aca6 --- /dev/null +++ b/data/test_input_rinex3_obs_SystemGeosync.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA S (GEOSYNC) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_SystemGlonass.15o b/data/test_input_rinex3_obs_SystemGlonass.15o new file mode 100644 index 000000000..b2f7525f2 --- /dev/null +++ b/data/test_input_rinex3_obs_SystemGlonass.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA R (GLONASS) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_SystemMixed.15o b/data/test_input_rinex3_obs_SystemMixed.15o new file mode 100644 index 000000000..857ee3f1a --- /dev/null +++ b/data/test_input_rinex3_obs_SystemMixed.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/data/test_input_rinex3_obs_SystemTransit.15o b/data/test_input_rinex3_obs_SystemTransit.15o new file mode 100644 index 000000000..03be4d008 --- /dev/null +++ b/data/test_input_rinex3_obs_SystemTransit.15o @@ -0,0 +1,154 @@ + 3.02 OBSERVATION DATA T (TRANSIT) RINEX VERSION / TYPE +cnvtToRINEX 2.25.0 convertToRINEX OPR 23-Jan-15 22:34 UTC PGM / RUN BY / DATE +----------------------------------------------------------- COMMENT +7619 MARKER NAME +7619 MARKER NUMBER +GEODETIC MARKER TYPE +GNSS Observer Trimble OBSERVER / AGENCY +5239497619 R8 Model 3 4.80 REC # / TYPE / VERS + TRM60158.00 ANT # / TYPE + -740287.1908 -5457064.3395 3207279.4677 APPROX POSITION XYZ + -0.0650 0.0000 0.0000 ANTENNA: DELTA H/E/N +G 8 C1C C2W C2X C5X L1C L2W L2X L5X SYS / # / OBS TYPES + 2014 10 31 20 28 0.0000000 GPS TIME OF FIRST OBS + 2014 10 31 20 36 0.0000000 GPS TIME OF LAST OBS + 0 RCV CLOCK OFFS APPL +G L1C 0.00000 SYS / PHASE SHIFT +G L2X -0.25000 SYS / PHASE SHIFT +G L5X 0.00000 SYS / PHASE SHIFT + 16 LEAP SECONDS + 9 # OF SATELLITES + G05 70 0 0 0 63 0 0 0 PRN / # OF OBS + G15 413 0 320 0 397 0 320 0 PRN / # OF OBS + G18 126 0 0 0 116 0 0 0 PRN / # OF OBS + G21 11 6 0 0 10 6 0 0 PRN / # OF OBS + G22 44 0 0 0 39 0 0 0 PRN / # OF OBS + G24 7 0 6 6 6 0 6 6 PRN / # OF OBS + G26 99 0 0 0 96 0 0 0 PRN / # OF OBS + G27 12 0 11 12 12 0 11 12 PRN / # OF OBS + G29 130 0 69 0 122 0 69 0 PRN / # OF OBS + END OF HEADER +> 2014 10 31 20 28 0.0000000 0 2 +G05 23448820.047 5 123224404.83915 +G15 20678535.828 5 108666319.37715 +> 2014 10 31 20 28 15.0000000 0 2 +G05 23456156.969 5 123262969.935 5 +G15 20673040.539 6 108637434.531 6 +> 2014 10 31 20 28 30.0000000 0 2 +G05 23463576.977 5 123301955.861 5 +G15 20667651.695 6 108609104.799 6 +> 2014 10 31 20 28 45.0000000 0 2 +G05 23471043.063 5 123341185.710 5 +G15 20662332.773 6 108581153.495 6 +> 2014 10 31 20 29 0.0000000 0 2 +G05 23478541.297 5 123380595.658 5 +G15 20657073.836 6 108553517.106 6 +> 2014 10 31 20 29 15.0000000 0 3 +G05 23486064.781 5 123420144.292 5 +G15 20651865.766 6 108526154.488 6 +G26 21115083.484 5 110960525.89715 +> 2014 10 31 20 29 30.0000000 0 3 +G05 23493616.164 5 123459815.468 5 +G15 20646707.430 6 108499050.421 6 +G26 21115595.766 6 110963214.438 6 +> 2014 10 31 20 29 45.0000000 0 3 +G05 23501183.297 5 123499585.388 5 +G15 20641594.555 6 108472181.151 6 +G26 21116155.563 5 110966172.712 5 +> 2014 10 31 20 30 0.0000000 0 3 +G05 23508767.742 5 123539445.678 5 +G15 20636526.461 6 108445538.969 6 +G26 21116769.313 5 110969392.667 5 +> 2014 10 31 20 30 15.0000000 0 3 +G05 23516367.422 5 +G15 20631497.656 6 108419110.505 6 +G26 21117429.227 6 110972860.707 6 +> 2014 10 31 20 30 30.0000000 0 3 +G05 23523980.516 5 123619391.09915 +G15 20626507.734 6 108392890.354 6 +G26 21118135.719 5 110976571.410 5 +> 2014 10 31 20 30 45.0000000 0 3 +G05 23531606.875 5 123659463.91615 +G15 20621556.625 6 108366872.41716 +G26 21118885.977 5 110980518.13515 +> 2014 10 31 20 31 0.0000000 0 3 +G05 23539244.266 5 123699595.365 5 +G15 20616641.648 6 20616642.996 5 108341050.864 6 84421706.86515 +G26 21119681.305 5 110984694.882 5 +> 2014 10 31 20 31 15.0000000 0 3 +G05 23546891.625 5 123739780.501 5 +G15 20611763.289 6 20611765.848 5 108315421.559 6 84401735.989 5 +G26 21120519.180 5 110989097.188 5 +> 2014 10 31 20 31 30.0000000 0 3 +G05 23554549.383 6 123780011.543 6 +G15 20606919.867 5 20606924.199 5 108289977.116 5 84381909.147 5 +G26 21121398.172 5 110993717.515 5 +> 2014 10 31 20 31 45.0000000 0 3 +G05 23562213.633 6 123820285.284 6 +G15 20602110.828 5 20602115.344 5 108264714.364 5 84362223.881 5 +G26 21122317.172 5 110998552.268 5 +> 2014 10 31 20 32 0.0000000 0 3 +G05 23569886.922 6 123860598.588 6 +G15 20597338.203 5 20597341.281 5 108239630.807 5 84342678.255 5 +G26 21123277.234 5 111003598.744 5 +> 2014 10 31 20 32 15.0000000 0 3 +G05 23577563.977 6 123900947.759 6 +G15 20592597.633 5 20592602.711 5 108214723.053 5 84323269.599 5 +G26 21124276.852 5 111008853.421 5 +> 2014 10 31 20 32 30.0000000 0 4 +G05 23585250.625 6 123941334.503 6 +G15 20587891.719 6 20587897.730 5 108189993.234 6 84303999.629 5 +G26 21125316.469 5 111014318.26715 +G29 20014307.977 5 105175853.60015 +> 2014 10 31 20 32 45.0000000 0 4 +G05 23592943.008 5 123981750.453 5 +G15 20583218.891 6 20583223.738 5 108165433.214 6 84284861.951 5 +G26 21126398.781 5 111019984.71615 +G29 20015236.883 5 105180717.95315 +> 2014 10 31 20 33 0.0000000 0 4 +G05 23600637.977 5 124022196.634 5 +G15 20578578.492 6 20578582.074 6 108141044.498 6 84265857.736 6 +G26 21127516.703 5 111025853.88015 +G29 20016192.453 5 105185755.886 5 +> 2014 10 31 20 33 15.0000000 0 3 +G05 23608338.125 5 124062667.34415 +G15 20573968.227 6 20573972.445 6 108116821.617 6 84246982.759 6 +G26 21128668.367 5 111031920.19415 +> 2014 10 31 20 33 30.0000000 0 2 +G15 20569391.852 6 20569393.141 6 108092764.877 6 84228237.228 6 +G26 21129859.633 5 111038183.65915 +> 2014 10 31 20 33 45.0000000 0 2 +G15 20564844.711 6 20564845.199 5 108068868.056 6 84209616.315 5 +G26 21131086.656 4 111044637.70714 +> 2014 10 31 20 34 0.0000000 0 1 +G15 20560329.172 6 20560327.680 5 108045132.875 6 84191121.362 5 +> 2014 10 31 20 34 15.0000000 0 1 +G15 20555842.438 6 20555840.898 5 108021557.755 6 84172751.133 5 +> 2014 10 31 20 34 30.0000000 0 1 +G15 20551386.750 6 20551385.582 5 107998141.497 6 84154504.701 5 +> 2014 10 31 20 34 45.0000000 0 1 +G15 20546961.906 6 20546960.676 5 107974886.887 6 84136384.282 5 +> 2014 10 31 20 35 0.0000000 0 1 +G15 20542566.781 6 20542565.906 5 107951787.770 6 84118385.010 5 +> 2014 10 31 20 35 15.0000000 0 1 +G15 20538202.578 6 20538202.027 5 107928851.360 6 84100512.546 5 +> 2014 10 31 20 35 30.0000000 0 2 +G15 20533866.352 6 20533866.473 5 107906071.509 6 84082762.049 5 +G26 21140698.195 5 111095134.78515 +> 2014 10 31 20 35 45.0000000 0 2 +G15 20529562.898 5 20529564.094 5 107883452.843 5 84065137.160 5 +G26 21142214.242 5 111103103.502 5 +> 2014 10 31 20 36 0.0000000 0 2 +G15 20525288.648 5 20525289.965 5 107860991.34715 84047634.75215 +G26 21143764.133 5 111111258.016 5 +> 2014 10 31 20 36 15.0000000 0 2 +G15 20521044.516 4 20521044.645 5 107838685.39814 84030253.52115 +G26 21145348.211 5 111119595.94715 +> 2014 10 31 20 36 30.0000000 0 1 +G26 21146967.773 5 111128116.86115 +> 2014 10 31 20 36 45.0000000 0 2 +G05 23716497.344 5 124630917.72415 +G26 21148625.883 5 111136822.201 5 +> 2014 10 31 20 37 0.0000000 0 2 +G05 23724240.625 5 124671616.068 5 +G26 21150320.836 5 111145715.912 5 diff --git a/ext/apps/CMakeLists.txt b/ext/apps/CMakeLists.txt index 66f3de313..c25a07eb1 100755 --- a/ext/apps/CMakeLists.txt +++ b/ext/apps/CMakeLists.txt @@ -8,6 +8,7 @@ add_subdirectory (difftools) add_subdirectory (filetools) add_subdirectory (geomatics) add_subdirectory (mergetools) +add_subdirectory (misc) add_subdirectory (time) # If on UNIX, do these diff --git a/ext/apps/Rinextools/CMakeLists.txt b/ext/apps/Rinextools/CMakeLists.txt index 1c988d7f2..86e55e352 100755 --- a/ext/apps/Rinextools/CMakeLists.txt +++ b/ext/apps/Rinextools/CMakeLists.txt @@ -2,17 +2,21 @@ add_executable(RinDump RinDump.cpp) target_link_libraries(RinDump gpstk) -install (TARGETS RinDump DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS RinDump DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(RinDumpTest RinDump) add_executable(RinEdit RinEdit.cpp) target_link_libraries(RinEdit gpstk) -install (TARGETS RinEdit DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS RinEdit DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(RinEditTest RinEdit) add_executable(RinNav RinNav.cpp) target_link_libraries(RinNav gpstk) -install (TARGETS RinNav DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS RinNav DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(RinNavTest RinNav) -add_executable(RinSum RinSum.cpp) +add_executable(RinSum RinSum.cpp msecHandler.cpp) target_link_libraries(RinSum gpstk) -install (TARGETS RinSum DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS RinSum DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(RinSumeTest RinSum) diff --git a/ext/apps/Rinextools/README b/ext/apps/Rinextools/README index a53f2ecfc..c0d12ced5 100644 --- a/ext/apps/Rinextools/README +++ b/ext/apps/Rinextools/README @@ -1,22 +1,45 @@ Rinex tools (/apps/Rinextools) This directory contains 4 standalone programs which are useful in -manipulating Rinex version 2 or 3 observation files. Each program has a 'syntax page' that gives instructions on how to run it; see the syntax page by running without arguments or with --help. - -They apps are: - RinDump dumps Rinex observation data in columns in a flat file, useful - for plotting; also computes and dumps standard linear combinations - of data, for example ionosphere-free phase or Melbourne-Wubbena combo. +manipulating Rinex observation files. They are: + RinexDump dumps Rinex observation data in columns in a flat file, useful + for plotting RinSum summarizes a Rinex observation file - RinEdit reads and edits a Rinex observation file, writing out the a + EditRinex reads and edits a Rinex observation file, writing out the a new, edited one. - RinNav reads any number of Rinex (ver 2 or 3) navigation files and prints a - summary on the screen; also, if an output file or files are specified, - writes a unique superset of all the ephemeris data to that file(s). - It will also correct the time on the epoch line if it is inconsistent - with the week number in the ephemeris. + ResCor reads a Rinex file(s) and computes any of several residuals and + corrections from the data, and then writes them to an output + Rinex observation file. + NavMerge reads any number of Rinex navigation files and either prints a + summary on the screen, or, if an output file is specified, + writes a unique superset of all the ephemeris data to that file. + It will also correct the week number in the ephemeris if it is + inconsistent with the time on the epoch line. + + In addition there is the RinexEditor module, which implements a class that +may be called within other programs to edit the Rinex data. The EditRinex program is really just a shell that calls the RinexEditor, while ResCor is a more complicated program that also calls the RinexEditor but also modifies the data (i.e. computes the residuals and corrections) before writing it out. + + All of these programs are run from the command line, and input and outputs are all flat files. To see the command line syntax, run the program with either no arguments, or with arguments but including --help. + + Examples are not included here; however, examples are available elsewhere. RinSum is very easy to run; try typing + + RinSum -i + +at the command line for any Rinex observation file . Note, also, that the +discontinuity corrector uses EditRinex to apply its corrections, and that an +example of this is found in /apps/cycleslips/examples. Finally, the RinexPlot utility (/apps/RinexPlot) makes extensive use of the other utility programs +here; it is actually a Perl script and runs these programs from the command +line. + +Brian Tolman +btolman@arlut.utexas.edu + + + + + + + -Comments appreciated; submit them to the wiki. Enjoy! -Dr. Brian W. Tolman diff --git a/ext/apps/Rinextools/RinDump.cpp b/ext/apps/Rinextools/RinDump.cpp index d50682897..e65720061 100644 --- a/ext/apps/Rinextools/RinDump.cpp +++ b/ext/apps/Rinextools/RinDump.cpp @@ -92,7 +92,7 @@ using namespace gpstk; using namespace StringUtils; //------------------------------------------------------------------------------------ -string Version(string("2.2 10/31/13")); +string Version(string("2.3 8/26/15")); // TD // VI LAT LON not implemented // Code selection is not implemented - where to replace C1* with C1W ? @@ -124,7 +124,7 @@ class LinCom { map > sysObsids; // parallel vector of RinexObsIDs /// Constructor - LinCom() throw() : label(string("Undef")),value(0), limit0(false) { } + LinCom() throw() : value(0), limit0(false), label(string("Undef")) { } /// parse input string bool ParseAndSave(const string& str, bool save=true) throw(); @@ -173,7 +173,7 @@ class Configuration : public Singleton { string Title; // id line printed to screen and log // start command line input - bool help, verbose, typehelp, combohelp, noHeader; + bool help, verbose, typehelp, combohelp, noHeader, doTECU; int debug; string cfgfile; @@ -378,7 +378,7 @@ try { } catch(Exception& e) { os << "Exception: " << e.what() << endl; isValid = false; continue; } - catch(exception& e) { + catch(std::exception& e) { os << "exception: " << e.what(); isValid = false; continue; } startNameMap.insert( @@ -780,7 +780,7 @@ void Configuration::SetDefaults(void) throw() elevlimit = 0.0; userfmt = gpsfmt; - help = verbose = noHeader = false; + help = verbose = noHeader = doTECU = false; debug = -1; NonObsTags.push_back("RNG"); @@ -883,7 +883,7 @@ int Configuration::ProcessUserInput(int argc, char **argv) throw() " > System(s) may be fixed by --sys, or specified as first of 4-char ObsID oi\n" " > Below, beta = fi/fj (fi and fj are frequencies); alpha = beta^2 - 1\n" " > Phases are multiplied by wavelength, leaving everything in units meters\n" -" SI:t:ij Slant ionospheric delay\n" +" SI:t:ij Slant ionospheric delay (in meters, unless --TECU)\n" " e.g. SI:C:12 = (C1X - C2X)/alpha\n" " VI:t:ij Vertical ionospheric delay [requires --eph --ref --ionoht]\n" " VI = SI * obliquity factor\n" @@ -1199,7 +1199,7 @@ string Configuration::BuildCommandLine(void) throw() "Stop processing data at this epoch"); opts.Add(0, "decimate", "dt", false, false, &decimate, "", "Decimate data to time interval dt (0: no decimation)"); - opts.Add(0, "debias", "type,lim", true, false, &typeLimit, "", + opts.Add(0, "debias", "type:lim", true, false, &typeLimit, "", "Debias jumps in data larger than limit (0: no debias)"); opts.Add(0, "debias0", "type", true, false, &typeLimit0, "", "Toggle initial debias of data ()"); @@ -1220,6 +1220,8 @@ string Configuration::BuildCommandLine(void) throw() "Format for time tags (see GPSTK::Epoch::printf) in output"); opts.Add(0, "headless", "", false, false, &noHeader, "", "Turn off printing of headers and no-eph-warnings in output"); + opts.Add(0, "TECU", "", false, false, &doTECU, "", + "Compute iono delay (SI,VI) in TEC units (else meters)"); opts.Add(0, "verbose", "", false, false, &verbose, "", "Print extra output information"); opts.Add(0, "debug", "", false, false, &debug, "", @@ -1418,7 +1420,11 @@ int Configuration::ExtraProcessing(string& errors, string& extras) throw() // debiasing limits for(i=0; i 0.0) { + if(C.decTime == CommonTime::BEGINNING_OF_TIME) C.decTime = Rdata.time; double dt(::fabs(Rdata.time - C.decTime)); dt -= C.decimate * long(0.5 + dt/C.decimate); if(::fabs(dt) > 0.25) { @@ -1897,8 +1905,10 @@ bool LinCom::ParseAndSave(const string& lab, bool save) throw() vector fld(split(lab,':')); // split into fields on : string tag(fld[0]); // LinCom tag ~ SI,VI,IF,GF,WLC,NLC,etc - if(find(C.LinComTags.begin(), C.LinComTags.end(), tag) == C.LinComTags.end()) - return false; // tag is not in the list + //if(find(C.LinComTags.begin(), C.LinComTags.end(), tag) == C.LinComTags.end()) { + // LOG(DEBUG2) << "tag is not in LinComTags list"; + // return false; // tag is not in the list + //} // set limit and limit0 limit = C.debLimit[tag]; @@ -2053,9 +2063,24 @@ bool LinCom::ParseAndSave(const string& lab, bool save) throw() // TD VI LAT LON not implemented if(tag == string("SI") || tag == string("VI")) { // iono delay double alpha(getAlpha(sat,n1,n2)); - //LOG(DEBUG2) << "Parse alpha is " << fixed << setprecision(4) << alpha; - sysConsts[sys].push_back(1.0/alpha); - sysConsts[sys].push_back(-1.0/alpha); + // convert to TECU + double TECUperM(1.0); + if(C.doTECU) { + if(sat.system == SatID::systemGPS) { + static const double GPSL1(L1_FREQ_GPS*1.e-8); + TECUperM = GPSL1*GPSL1/40.28; + } + else if(sat.system == SatID::systemGlonass) { + static const double GLOL1((L1_FREQ_GLO + + C.GLOfreqChan.count(sat)*L1_FREQ_STEP_GLO)*1.e-8); + TECUperM = GLOL1*GLOL1/40.28; + } + } + + //LOG(DEBUG2) << "Parse alpha is " << fixed << setprecision(4) << alpha + // << " for sat " << sat << " and TECUperM " << scientific << TECUperM; + sysConsts[sys].push_back(TECUperM/alpha); + sysConsts[sys].push_back(-TECUperM/alpha); } else if(tag == string("IF")) { // iono-free double alpha(getAlpha(sat,n1,n2)); @@ -2166,7 +2191,12 @@ bool LinCom::ParseAndSave(const string& lab, bool save) throw() while(tag.size()) { pos = tag.find_first_of("GRESCLD"); // system or obsid if(pos == string::npos) break; - consts.push_back(asDouble(tag.substr(0,pos))); + if(tag.substr(0,pos).empty() || tag.substr(0,pos) == "+") + consts.push_back(1.0); + else if(tag.substr(0,pos) == "-") + consts.push_back(-1.0); + else + consts.push_back(asDouble(tag.substr(0,pos))); tag = tag.substr(pos); pos = tag.find_first_of("+-"); diff --git a/ext/apps/Rinextools/RinEdit.cpp b/ext/apps/Rinextools/RinEdit.cpp index 102a621ca..cee388398 100644 --- a/ext/apps/Rinextools/RinEdit.cpp +++ b/ext/apps/Rinextools/RinEdit.cpp @@ -72,9 +72,9 @@ using namespace gpstk; using namespace StringUtils; //------------------------------------------------------------------------------------ - -string Version(string("2.2 10/31/13")); +string Version(string("2.4 9/23/15 rev")); // TD +// if reading a R2 file, allow obs types in cmds to be R2 versions (C1,etc) // option to replace input with output? // include optional fmt input for t in edit cmds - is this feasible? // if given a 4-char OT and SV, check their consistency @@ -95,7 +95,7 @@ class EditCmd { RinexSatID sat; // satellite RinexObsID obs; // observation type CommonTime ttag; // associated time tag - int sign; // sign +1,0,-1 + int sign; // sign +1,0,-1 meaning start, one-time, stop int idata; // integer e.g. SSI or LLI double data; // data e.g. bias value string field; // OF file name @@ -153,7 +153,7 @@ class Configuration : public Singleton { { defaultstartStr = string("[Beginning of dataset]"); defaultstopStr = string("[End of dataset]"); - beginTime = CommonTime::BEGINNING_OF_TIME; + beginTime = CivilTime(1980,1,6,0,0,0.0,TimeSystem::GPS).convertToCommonTime(); endTime = CommonTime::END_OF_TIME; decimate = 0.0; @@ -188,7 +188,7 @@ class Configuration : public Singleton { // editing commands bool HDdc,HDda,BZ; - string HDp,HDr,HDo,HDa,HDx,HDm,HDn,HDt,HDh; + string HDp,HDr,HDo,HDa,HDx,HDm,HDn,HDt,HDh,HDj,HDk,HDl,HDs; vector HDc,DA,DAm,DAp,DO,DS,DSp,DSm,DD,DDp,DDm; vector SD,SS,SL,SLp,SLm,BD,BDp,BDm,BS,BL; @@ -235,7 +235,7 @@ try { wallclkbeg.setLocalTime(); // build title = first line of output - C.Title = "# " + C.PrgmName + ", part of the GPS Toolkit, Ver 2.2" + C.Title = "# " + C.PrgmName + ", part of the GPS Toolkit, Ver " + Version + ", Run " + printTime(wallclkbeg,C.calfmt); for(;;) { @@ -328,6 +328,8 @@ try { << "(--start) is not an even GPS-seconds-of-week mark."; C.decTime = static_cast( GPSWeekSecond(static_cast(C.decTime).week,0.0)); + LOG(DEBUG) << "Decimate, with final decimate ref time " + << printTime(C.decTime,C.longfmt) << " and step " << C.decimate; } // -------- save errors and output @@ -500,7 +502,7 @@ try { iret = 3; break; } - catch(exception& e) { + catch(std::exception& e) { Exception ge(string("Std excep: ") + e.what()); GPSTK_THROW(ge); } @@ -532,6 +534,7 @@ try { if(C.decimate > 0.0) { double dt(::fabs(Rdata.time - C.decTime)); dt -= C.decimate * long(0.5 + dt/C.decimate); + LOG(DEBUG) << "Decimate? dt = " << fixed << setprecision(2) << dt; if(::fabs(dt) > 0.25) { LOG(DEBUG) << " Decimation rejects RINEX data timetag " << printTime(Rdata.time,C.longfmt); @@ -564,8 +567,13 @@ try { try { C.ostrm << RDout; } catch(Exception& e) { GPSTK_RETHROW(e); } - // debug: dump the RINEX data object - if(C.debug > -1) Rdata.dump(LOGstrm,Rhead); + // debug: dump the RINEX data objects input and output + if(C.debug > -1) { + LOG(DEBUG) << "INPUT data ---------------"; + Rdata.dump(LOGstrm,Rhead); + LOG(DEBUG) << "OUTPUT data ---------------"; + RDout.dump(LOGstrm,Rhead); + } } // end while loop over epochs @@ -580,6 +588,8 @@ try { } // end loop over files // final clean up + LOG(INFO) << " Close output file."; + C.ostrm.close(); if(iret < 0) return iret; @@ -607,18 +617,31 @@ int ProcessOneEpoch(Rinex3ObsHeader& Rhead, Rinex3ObsHeader& RHout, else { // regular data vector::iterator it, jt; + vector toCurr; // for cmds with ttag <= now either execute and delete, or move to current it = C.vecCmds.begin(); while(it != C.vecCmds.end()) { + LOG(DEBUG) << "Process vec cmd " << it->asString(); if(it->ttag <= now || ::fabs(it->ttag - now) < C.timetol) { - // execute command; // delete one-time cmds, move others to curr and delete iret = ExecuteEditCmd(it, RHout, RDout); - if(iret < 0) return iret; + if(iret < 0) return iret; // fatal error // keep this command on the current list - if(iret > 0) C.currCmds.push_back(*it); + if(iret > 0) toCurr.push_back(*it); // C.currCmds.push_back(*it); + + // if this is a '-' cmd to be deleted, find matching '+' and delete it + // note FixEditCmdList() forced every - to have a corresponding + + if(iret == 0 && it->sign == -1) { + for(jt = C.currCmds.begin(); jt != C.currCmds.end(); ++jt) + if(jt->type==it->type && jt->sat==it->sat && jt->obs==it->obs) + break; + if(jt == C.currCmds.end()) + GPSTK_THROW(Exception(string( + "Execute failed to find + cmd matching ") + it->asString())); + C.currCmds.erase(jt); + } // remove from vecCmds it = C.vecCmds.erase(it); // erase vector element @@ -630,6 +653,7 @@ int ProcessOneEpoch(Rinex3ObsHeader& Rhead, Rinex3ObsHeader& RHout, // apply current commands, deleting obsolete ones it = C.currCmds.begin(); while(it != C.currCmds.end()) { + LOG(DEBUG) << "Execute current cmd " << it->asString(); // execute command; delete obsolete commands iret = ExecuteEditCmd(it, RHout, RDout); if(iret < 0) return iret; @@ -639,6 +663,9 @@ int ProcessOneEpoch(Rinex3ObsHeader& Rhead, Rinex3ObsHeader& RHout, else ++it; } + + for(it = toCurr.begin(); it != toCurr.end(); ++it) + C.currCmds.push_back(*it); } return 0; @@ -654,15 +681,16 @@ int ExecuteEditCmd(const vector::iterator& it, Rinex3ObsHeader& Rhead, throw(Exception) { Configuration& C(Configuration::Instance()); - size_t i; + size_t i,j; string sys; vector flds; - Rinex3ObsData::DataMap::iterator kt; + vector sats; + Rinex3ObsData::DataMap::const_iterator kt; vector::iterator jt; try { if(it->type == EditCmd::INVALID) { - // message? + LOG(DEBUG) << " Invalid command " << it->asString(); return 0; } @@ -675,7 +703,7 @@ int ExecuteEditCmd(const vector::iterator& it, Rinex3ObsHeader& Rhead, C.ostrm.open(it->field.c_str(),ios::out); if(!C.ostrm.is_open()) { LOG(ERROR) << "Error : could not open output file " << it->field; - return 1; + return -1; } C.ostrm.exceptions(ios::failbit); @@ -689,12 +717,21 @@ int ExecuteEditCmd(const vector::iterator& it, Rinex3ObsHeader& Rhead, if(!C.HDr.empty()) Rhead.fileAgency = C.HDr; if(!C.HDo.empty()) Rhead.observer = C.HDo; if(!C.HDa.empty()) Rhead.agency = C.HDa; + if(!C.HDj.empty()) Rhead.recNo = C.HDj; + if(!C.HDk.empty()) Rhead.recType = C.HDk; + if(!C.HDl.empty()) Rhead.recVers = C.HDl; + if(!C.HDs.empty()) Rhead.antNo = C.HDs; if(!C.HDx.empty()) { - flds = split(C.HDx,','); // TD check n==3,doubles in Initialize + flds = split(C.HDx,','); + // TD check n==3,doubles in Initialize for(i=0; i<3; i++) Rhead.antennaPosition[i] = asDouble(flds[i]); } if(!C.HDm.empty()) Rhead.markerName = C.HDm; - if(!C.HDn.empty()) Rhead.markerNumber = C.HDn; + if(!C.HDn.empty()) + { + Rhead.markerNumber = C.HDn; + Rhead.valid |= Rinex3ObsHeader::validMarkerNumber; + } if(!C.HDt.empty()) Rhead.antType = C.HDt; if(!C.HDh.empty()) { flds = split(C.HDh,','); // TD check n==3,doubles in Initialize @@ -716,16 +753,19 @@ int ExecuteEditCmd(const vector::iterator& it, Rinex3ObsHeader& Rhead, // write the header C.ostrm << Rhead; + return 0; } // DA delete all --------------------------------------------------------------- else if(it->type == EditCmd::DA) { switch(it->sign) { case 1: case 0: - Rdata.numSVs = 0; // clear this data, return 0 + Rdata.numSVs = 0; // clear this data, keep the cmd Rdata.obs.clear(); + if(it->sign == 0) return 0; break; - case -1: return 1; // delete the (-) command + case -1: + return 0; // delete the (-) command break; } } @@ -736,80 +776,106 @@ int ExecuteEditCmd(const vector::iterator& it, Rinex3ObsHeader& Rhead, return 0; // DS delete satellite --------------------------------------------------------- - // TD what if entire system is deleted else if(it->type == EditCmd::DS) { - if(it->sign == -1) return 1; // delete the (-) command - + if(it->sign == -1) return 0; // delete the (-) command // find the SV - kt = Rdata.obs.find(it->sat); - if(kt != Rdata.obs.end()) { // found the SV - Rdata.obs.erase(kt); // remove it + LOG(DEBUG) << " Delete sat " << it->asString(); + if(it->sat.id > 0) { + kt = Rdata.obs.find(it->sat); + if(kt != Rdata.obs.end()) // found the SV + sats.push_back(kt->first); + else + LOG(DEBUG) << " Execute: sat " << it->sat << " not found in data"; + } + else { + sats.clear(); + for(kt=Rdata.obs.begin(); kt!=Rdata.obs.end(); ++kt) + if(kt->first.system == it->sat.system) + sats.push_back(kt->first); + } + for(j=0; jsign == 0) return 1; // delete the one-time command + if(it->sign == 0) return 0; // delete the one-time command } // ----------------------------------------------------------------------------- // the rest require that we find satellite and obsid in Rdata.obs else { - if(it->sign == -1) return 1; // delete the (-) command - - kt = Rdata.obs.find(it->sat); // find the sat - if(kt == Rdata.obs.end()) // sat not found - return 0; // (this may be normal) + if(it->sign == -1) return 0; // delete the (-) command sys = asString(it->sat.systemChar()); // find the system // find the OT in the header map, and get index into vector jt = find(Rhead.mapObsTypes[sys].begin(), Rhead.mapObsTypes[sys].end(), it->obs); - if(jt == Rhead.mapObsTypes[sys].end()) // ObsID not found + if(jt == Rhead.mapObsTypes[sys].end()) { // ObsID not found // TD message? user error: ask to delete one that's not there - return 0; + LOG(DEBUG) << " Execute: obstype " << it->obs << " not found in header"; + return 0; // delete the cmd + } i = (jt - Rhead.mapObsTypes[sys].begin()); // index into vector - switch(it->type) { - // DD delete data -------------------------------------------------------- - case EditCmd::DD: - Rdata.obs[it->sat][i].data = 0.0; - Rdata.obs[it->sat][i].ssi = 0; - Rdata.obs[it->sat][i].lli = 0; - break; - // SD set data ----------------------------------------------------------- - case EditCmd::SD: - Rdata.obs[it->sat][i].data = it->data; - break; - // SS set SSI ------------------------------------------------------------ - case EditCmd::SS: - Rdata.obs[it->sat][i].ssi = it->idata; - break; - // SL set LLI ------------------------------------------------------------ - case EditCmd::SL: - Rdata.obs[it->sat][i].lli = it->idata; - break; - // BD bias data ---------------------------------------------------------- - case EditCmd::BD: - Rdata.obs[it->sat][i].data += it->data; - break; - // BS bias SSI ----------------------------------------------------------- - case EditCmd::BS: - Rdata.obs[it->sat][i].ssi += it->idata; - break; - // BL bias LLI ----------------------------------------------------------- - case EditCmd::BL: - Rdata.obs[it->sat][i].lli += it->idata; - break; - // never reached --------------------------------------------------------- - default: - // message? - break; + // find the sat + if(it->sat.id > 0) { + if(Rdata.obs.find(it->sat)==Rdata.obs.end()) { // sat not found + LOG(DEBUG) << " Execute: sat " << it->sat << " not found in data"; + } + else + sats.push_back(it->sat); + } + else { + for(kt=Rdata.obs.begin(); kt!=Rdata.obs.end(); ++kt) { + if(kt->first.system == it->sat.system) + sats.push_back(kt->first); + } + } + + for(j=0; jtype) { + // DD delete data ----------------------------------------------------- + case EditCmd::DD: + Rdata.obs[sats[j]][i].data = 0.0; + Rdata.obs[sats[j]][i].ssi = 0; + Rdata.obs[sats[j]][i].lli = 0; + break; + // SD set data -------------------------------------------------------- + case EditCmd::SD: + Rdata.obs[sats[j]][i].data = it->data; + break; + // SS set SSI --------------------------------------------------------- + case EditCmd::SS: + Rdata.obs[sats[j]][i].ssi = it->idata; + break; + // SL set LLI --------------------------------------------------------- + case EditCmd::SL: + Rdata.obs[sats[j]][i].lli = it->idata; + break; + // BD bias data ------------------------------------------------------- + case EditCmd::BD: + Rdata.obs[sats[j]][i].data += it->data; + break; + // BS bias SSI -------------------------------------------------------- + case EditCmd::BS: + Rdata.obs[sats[j]][i].ssi += it->idata; + break; + // BL bias LLI -------------------------------------------------------- + case EditCmd::BL: + Rdata.obs[sats[j]][i].lli += it->idata; + break; + // never reached ------------------------------------------------------ + default: + // message? + break; + } } - if(it->sign == 0) return 1; // delete the one-time command + if(it->sign == 0) return 0; // delete the one-time command } - return 0; + return 1; } catch(Exception& e) { GPSTK_RETHROW(e); } } // end ExecuteEditCmd() @@ -871,7 +937,7 @@ int Configuration::ProcessUserInput(int argc, char **argv) throw() << " command line configuration ------\n"; opts.DumpConfiguration(oss); if(!cmdlineExtras.empty()) oss << "# Extra Processing:\n" << cmdlineExtras; - oss << "------ End configuration summary ------"; + oss << "\n------ End configuration summary ------"; LOG(DEBUG) << oss.str(); } @@ -930,11 +996,19 @@ string Configuration::BuildCommandLine(void) throw() opts.Add(0, "HDx", "x,y,z", false, false, &HDx, "", "Set header 'POSITION' field to (ECEF, m)"); opts.Add(0, "HDm", "m", false, false, &HDm, "", - "Set header 'MARKER' field to "); + "Set header 'MARKER NAME' field to "); opts.Add(0, "HDn", "n", false, false, &HDn, "", - "Set header 'NUMBER' field to "); + "Set header 'MARKER NUMBER' field to "); + opts.Add(0, "HDj", "n", false, false, &HDj, "", + "Set header 'REC #' field to "); + opts.Add(0, "HDk", "t", false, false, &HDk, "", + "Set header 'REC TYPE' field to "); + opts.Add(0, "HDl", "v", false, false, &HDl, "", + "Set header 'REC VERS' field to "); + opts.Add(0, "HDs", "n", false, false, &HDs, "", + "Set header 'ANT #' field to "); opts.Add(0, "HDt", "t", false, false, &HDt, "", - "Set header 'ANTENNA TYPE' field to "); + "Set header 'ANT TYPE' field to "); opts.Add(0, "HDh", "h,e,n", false, false, &HDh, "", "Set header 'ANTENNA OFFSET' field to (Ht,East,North)"); opts.Add(0, "HDc", "c", true, false, &HDc, "", @@ -1191,7 +1265,7 @@ EditCmd::EditCmd(const string intypestr, const string inarg) throw(Exception) tag = tag.substr(0,2); flds = split(arg,','); // split arg - const int n(flds.size()); // number of args + const size_t n(flds.size()); // number of args if(tag == "OF") { if(n != 1 && n != 3 && n != 7) return; @@ -1225,6 +1299,7 @@ EditCmd::EditCmd(const string intypestr, const string inarg) throw(Exception) stripLeading(arg,flds[0]+","); if(!parseTime(arg,ttag)) return; } + if(sign == 0 && n == 1) sign = 1; type = DS; } else { @@ -1236,7 +1311,7 @@ EditCmd::EditCmd(const string intypestr, const string inarg) throw(Exception) string dat; if(tag != "DD") { // strip and save last arg (dsl) dat = flds[flds.size()-1]; - stripTrailing(arg,","+dat); + stripTrailing(arg,string(",")+dat); } if(!parseTime(arg,ttag)) return; // get the time @@ -1327,7 +1402,7 @@ string EditCmd::asString(string msg) throw(Exception) return os.str(); } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E(string("std::except: ") + e.what()); GPSTK_THROW(E); } @@ -1349,9 +1424,12 @@ void FixEditCmdList(void) throw() if(it->sign == -1 && it->type != EditCmd::INVALID) { bool havePair(false); if(it != C.vecCmds.begin()) { - --(jt = it); + jt = it; --jt; // --(jt = it); while(1) { // search backwards for match - if(jt->type == it->type && jt->sat == it->sat) { + if(jt->type == it->type && + jt->sat == it->sat && + jt->obs == it->obs) + { if(jt->sign == 1) havePair=true; // its a match else if(jt->sign == -1) { // this is an error LOG(ERROR) << it->asString("Error: repeat '-'"); diff --git a/ext/apps/Rinextools/RinSum.cpp b/ext/apps/Rinextools/RinSum.cpp index a3bcc66c1..34fae8bb7 100644 --- a/ext/apps/Rinextools/RinSum.cpp +++ b/ext/apps/Rinextools/RinSum.cpp @@ -1,3 +1,6 @@ +/// @file RinSum.cpp +/// Read Rinex observation files (version 2 or 3) and output a summary of the content. + //============================================================================ // // This file is part of GPSTk, the GPS Toolkit. @@ -34,9 +37,6 @@ // //============================================================================= -/// @file RinSum.cpp -/// Read Rinex observation files (version 2 or 3) and output a summary of the content. - // system #include #include @@ -52,6 +52,7 @@ #include "singleton.hpp" #include "expandtilde.hpp" +#include "stl_helpers.hpp" #include "logstream.hpp" #include "CommandLine.hpp" @@ -67,13 +68,15 @@ #include "Rinex3ObsData.hpp" #include "RinexUtilities.hpp" +#include "msecHandler.hpp" + //------------------------------------------------------------------------------------ using namespace std; using namespace gpstk; using namespace StringUtils; //------------------------------------------------------------------------------------ -string Version(string("2.2 10/31/13")); +string Version(string("4.1 8/26/15")); //------------------------------------------------------------------------------------ // Object for command line input and global data @@ -106,9 +109,10 @@ class Configuration : public Singleton { beginTime.setTimeSystem(TimeSystem::Any); endTime.setTimeSystem(TimeSystem::Any); userfmt = gpsfmt; - help = verbose = brief = nohead = notab = gpstime = sorttime = vistab = false; + help = verbose = brief = nohead = notab = gpstime = sorttime = vistab + = dogaps = doms = false; debug = -1; - gapdt = 0.0; + dt = -1.0; vres = 0; } // end Configuration::SetDefaults() @@ -120,9 +124,9 @@ class Configuration : public Singleton { string Title; // id line printed to screen and log // start command line input - bool help, verbose, brief, nohead, notab, gpstime, sorttime, vistab; + bool help, verbose, brief, nohead, notab, gpstime, sorttime, dogaps, doms, vistab; int debug, vres; - double gapdt; + double dt; string cfgfile, userfmt; vector InputObsFiles; // RINEX obs file names @@ -143,6 +147,9 @@ class Configuration : public Singleton { static const string calfmt,gpsfmt,longfmt; ofstream logstrm; + // for milliseconds + msecHandler msh; + }; // end class Configuration //------------------------------------------------------------------------------------ @@ -266,6 +273,9 @@ try { LOG(ERROR) << C.msg; } + // initialize millisecond handler + if(C.doms) C.msh.setDT(C.dt); + // -------- save errors and output //errors = oss.str(); //stripTrailing(errors,'\n'); @@ -280,7 +290,6 @@ catch(Exception& e) { GPSTK_RETHROW(e); } //------------------------------------------------------------------------------------ int Configuration::ProcessUserInput(int argc, char **argv) throw() { - int i; string PrgmDesc,cmdlineUsage, cmdlineErrors, cmdlineExtras; vector cmdlineUnrecognized; @@ -309,7 +318,7 @@ int Configuration::ProcessUserInput(int argc, char **argv) throw() // pull out file name without --obs if(cmdlineUnrecognized.size() > 0) { - for(i=cmdlineUnrecognized.size()-1; i >= 0; i--) { + for(int i=cmdlineUnrecognized.size()-1; i >= 0; i--) { try { string filename(cmdlineUnrecognized[i]); ifstream ifstrm(filename.c_str()); @@ -338,8 +347,8 @@ int Configuration::ProcessUserInput(int argc, char **argv) throw() // output warning / error messages if(cmdlineUnrecognized.size() > 0) { LOG(WARNING) << "Warning - unrecognized arguments:"; - for(size_t i=0; i]\n" -" Options:"; + string PrgmDesc = " Program " + PrgmName + " reads one or more RINEX (v.2+) " + + "observation files and prints a summary of content.\n Options:"; + opts.DefineUsageString("RinSum [options]"); // options to appear on the syntax page, and to be accepted on command line //opts.Add(char, opt, arg, repeat?, required?, &target, pre-desc, desc); @@ -415,8 +423,12 @@ string Configuration::BuildCommandLine(void) throw() "Omit header from output"); opts.Add(0, "notable", "", false, false, ¬ab, "", "Omit sat/obs table from output"); - opts.Add(0, "gaps", "dt", false, false, &gapdt, "", - "Print a table of sat vs. data gaps, assuming data interval
sec"); + opts.Add(0, "dt", "sec", false, false, &dt, "", + "Nominal time step of data (sec); required only for gaps and millisec"); + opts.Add(0, "milli", "", false, false, &doms, "", + "Find millisecond clock adjusts; req's --dt"); + opts.Add(0, "gaps", "", false, false, &dogaps, "", + "Print a table of gaps in the data; req's --dt"); opts.Add(0, "vis", "n", false, false, &vres, "", "Print graphical visibility, resolution [n~20 @ 30s; req's --gaps]"); opts.Add(0, "vtab", "", false, false, &vistab, "", @@ -518,16 +530,26 @@ int Configuration::ExtraProcessing(string& errors, string& extras) throw() ossx << "Warning - Option --vis, must have n positive\n"; vres = 0; } - if(gapdt < 0.0) { - ossx << "Warning - Option --gaps, must have dt positive\n"; - gapdt = 0.0; + if(dt < 0.0 && dt != -1.0) { + ossx << "Warning - Option --dt, must have dt positive\n"; + dt = -1.0; + } + // milli requires dt + if(doms && dt == -1.0) { + ossx << "Warning - Option --milli requires --dt be given\n"; + doms = false; } - // vres requires gapdt - if(vres > 0 && gapdt == 0.0) { - ossx << "Warning - Option --vis requires that --gaps
be given\n"; + // gaps requires dt + if(dogaps && dt == -1.0) { + ossx << "Warning - Option --gaps requires --dt be given\n"; + dogaps = false; + } + // vres requires dt and gaps + if(vres > 0 && (dt == -1.0 || !dogaps)) { + ossx << "Warning - Option --vis requires --gaps and --dt be given\n"; vres = 0; } - else if(vistab && vres == 0) { + if(vistab && vres == 0) { ossx << "Warning - Option --vtab requires that --vis be given\n"; vistab = false; } @@ -548,21 +570,30 @@ int ProcessFiles(void) throw(Exception) { try { Configuration& C(Configuration::Instance()); - int iret,nfiles; - size_t i,k, j, nfile; + int iret,ii,k; + size_t i,j,nfile,nfiles; string tag; CommonTime lastObsTime, prevObsTime, firstObsTime; RinexSatID sat; Rinex3ObsStream ostrm; ostringstream oss; + // estimate time step const size_t ndtmax=15; double dt, bestdt[ndtmax]; int ndt[ndtmax]; + // cache the out-of-time-order records + bool cacheon; + vector cachetime; + vector > cache; for(nfiles=0,nfile=0; nfilesecond).size()) > nmaxobs) nmaxobs = (sit->second).size(); } + // initialize millisecond handler with obstypes and wavelengths + vector msots; + if(C.doms) { + vector waves; + // get obs types from header + for(sit=Rhead.mapObsTypes.begin(); sit != Rhead.mapObsTypes.end(); ++sit) { + // get the system + RinexSatID rsid; + rsid.fromString(sit->first); + SatID sid(rsid); + // TD support only GPS currently + if(rsid.systemChar() != 'G') continue; + // excluded satellites/systems + if(find(C.exSats.begin(), C.exSats.end(), rsid) != C.exSats.end()) + continue; + // get the obstypes, prepend the system character + for(i=0; isecond.size(); i++) { + tag = sit->second[i].asString(); // 3-char obs type + if(tag[0] == 'C' || tag[0] == 'L') { // code and phase only + msots.push_back(string(1,rsid.systemChar())+tag); + // get wavelength ... NB TD Glonass frequency channel not supported + if(tag[0] == 'L') { + ii = asInt(string(1,tag[1])); + waves.push_back(getWavelength(sid, ii)); + } + else + waves.push_back(0.0); + } + } + } + + C.msh.setObstypes(msots,waves); + LOG(DEBUG) << "Initialize millisecond handler with obs type, wavelength:"; + for(i=0; i 1) excluded + if(prevObsTime != CommonTime::BEGINNING_OF_TIME + && Rdata.time-prevObsTime < 1.e-3) + { + // save it + if(!cacheon) { // new block + cachetime.push_back(prevObsTime); + cacheon = true; + vector v; + cache.push_back(v); + } + cache[cache.size()-1].push_back(Rdata); + continue; + } + cacheon = false; + // look for gaps in the timetags int ncount; - if(C.gapdt > 0.0) { - ncount = int(0.5+(lastObsTime-firstObsTime)/C.gapdt); + if(C.dt > 0.0) { + ncount = int(0.5+(lastObsTime-firstObsTime)/C.dt); // update gap count if(C.gapcount.size() == 0) { // create the list C.gapcount.push_back(ncount); // start time @@ -722,7 +817,7 @@ try { C.gapcount.push_back(ncount); // end time } - // TD test after 50 epochs - wrong gapdt is disasterous + // TD test after 50 epochs - wrong dt is disasterous } // loop over satellites ------------------------------------- @@ -754,14 +849,14 @@ try { table.push_back(TableData(sat,nmaxobs)); ptab = find(table.begin(),table.end(),TableData(sat,nmaxobs)); ptab->begin = lastObsTime; - if(C.gapdt > 0.0) { + if(C.dt > 0.0) { ptab->gapcount.push_back(ncount); // start time ptab->gapcount.push_back(ncount-1); // end time } } // update list of gap times - if(C.gapdt > 0.0) { + if(C.dt > 0.0) { i = ptab->gapcount.size() - 1; // index of curr end time if(ncount == ptab->gapcount[i] + 1) // no gap ptab->gapcount[i] = ncount; @@ -795,6 +890,14 @@ try { totals[sysCode][index]++; // per system } + // if looking for milliseconds, update handler + if(C.doms && vecData[index].data != 0) { + tag = sysStr + Rhead.mapObsTypes[sysStr][index].asString(); + if(vectorindex(msots,tag) != -1) { + C.msh.add(lastObsTime, sat, tag, vecData[index].data); + } + } + if(C.debug > -1) oss << fixed << setprecision(3) << " " << asString(Rhead.mapObsTypes[sysStr][index]) << " " << setw(13) << vecData[index].data @@ -802,6 +905,7 @@ try { << " " << vecData[index].ssi; } // end loop over observations + if(C.debug > -1) LOG(DEBUG) << oss.str(); } // end loop over satellites @@ -887,6 +991,7 @@ try { LOG(INFO) << "Computed file size: " << filesize << " bytes."; // Reusing secs, as it is equivalent to the original expression + // i = 1+int(0.5+(lastObsTime-firstObsTime)/dt); i = 1+int(0.5 + secs / dt); LOG(INFO) << "There were " << nepochs << " epochs (" @@ -992,6 +1097,8 @@ try { for(i=0; i > Rinex3ObsHeader::mapSysR2toR3ObsID + //Rhead.mapSysR2toR3ObsID[sys][ot2] = OT3; if(Rhead.version < 3) { oss << " [v2:"; for(i=0; i 0.0) { + if(C.dogaps) { // summary of gaps using count oss.str(""); - oss << "\nSummary of gaps in the data in this file, assuming dt = " - << C.gapdt << " sec.\n"; - if(C.gapdt != dt) oss << " WARNING - computed dt does not match input dt\n"; + oss << "Summary of gaps (vs count) in the data in this file, " + << "assuming dt = " << C.dt << " sec.\n"; + if(C.dt != dt) oss << " Warning - computed dt does not match input dt\n"; oss << " First epoch = " << printTime(firstObsTime,C.longfmt) << " and last epoch = " << printTime(lastObsTime,C.longfmt) << endl; oss << " Sat beg - end (count,size) ... " << "[count = # of dt's from first epoch]\n"; - // print for timetags = all sats k = C.gapcount.size()-1; // size() is at least 2 oss << "GAP ALL " << setw(5) << C.gapcount[0] << " - " << setw(5) << C.gapcount[k]; - for(i=1; i<=k-2; i+=2) oss << " (" << C.gapcount[i]+1 // begin of gap - << "," << C.gapcount[i+1]-C.gapcount[i]-1 << ")"; // size - oss << endl; - //oss << "DUMP "; - //for(i=0; igapcount.size() - 1; oss << "GAP " << tabIt->sat << " " << setw(5) << tabIt->gapcount[0] << " - " << setw(5) << tabIt->gapcount[k]; - for(i=1; i<=k-2; i+=2) - oss << " (" << tabIt->gapcount[i]+1 // begin count of gap - << "," << tabIt->gapcount[i+1]-tabIt->gapcount[i]-1 << ")"; // size + // NB DO NOT make ii size_t + for(ii=1; ii<=k-2; ii+=2) + oss << " (" << tabIt->gapcount[ii]+1 << "," // begin count of gap + << tabIt->gapcount[ii+1]-tabIt->gapcount[ii]-1 << ")"; // size oss << endl; - - //oss << "DUMP "; - //for(i=0; igapcount.size();i++) - // oss << " " << tabIt->gapcount[i] - // << "(" << int(tabIt->gapcount[i]/double(C.vres)) << ")"; - //oss << "\n"; } tag = oss.str(); stripTrailing(tag,"\n"); @@ -1058,10 +1157,10 @@ try { // summary of gaps using sow oss.str(""); - double t(static_cast(firstObsTime).sow), d(C.gapdt); - oss << "\nSummary of gaps in the data in this file, assuming dt = " - << C.gapdt << " sec.\n"; - if(C.gapdt != dt) oss << " WARNING - computed dt does not match input dt\n"; + double t(static_cast(firstObsTime).sow), d(C.dt); + oss << "\nSummary of gaps (vs SOW) in the data in this file, assuming dt = " + << C.dt << " sec.\n"; + if(C.dt != dt) oss << " Warning - computed dt does not match input dt\n"; oss << " First epoch = " << printTime(firstObsTime,C.longfmt) << " and last epoch = " << printTime(lastObsTime,C.longfmt) << endl; oss << " Sat beg - end (sow,number of missing points)\n"; @@ -1070,8 +1169,10 @@ try { k = C.gapcount.size()-1; // size() is at least 2 oss << "GAP ALL " << fixed << setprecision(1) << setw(8) << t+d*C.gapcount[0] << " - " << setw(8) << t+d*C.gapcount[k]; - for(i=1; i<=k-2; i+=2) oss << " (" << t+d*(C.gapcount[i]+1)// begin of gap - << "," << C.gapcount[i+1]-C.gapcount[i]-1 << ")"; // size + // NB DO NOT make ii size_t + for(ii=1; ii<=k-2; ii+=2) + oss << " (" << t+d*(C.gapcount[ii]+1) // begin of gap + << "," << C.gapcount[ii+1]-C.gapcount[ii]-1 << ")"; // size oss << endl; // loop over sats @@ -1080,9 +1181,10 @@ try { oss << "GAP " << tabIt->sat << " " << fixed << setprecision(1) << setw(8) << t+d*tabIt->gapcount[0] << " - " << setw(8) << t+d*tabIt->gapcount[k]; - for(i=1; i<=k-2; i+=2) - oss << " (" << t+d*(tabIt->gapcount[i]+1) // begin sow of gap - << "," << tabIt->gapcount[i+1]-tabIt->gapcount[i]-1 << ")"; // size + // NB DO NOT make ii size_t + for(ii=1; ii<=k-2; ii+=2) + oss << " (" << t+d*(tabIt->gapcount[ii]+1) << "," // begin sow of gap + << tabIt->gapcount[ii+1]-tabIt->gapcount[ii]-1 << ")"; // size oss << endl; } @@ -1092,22 +1194,22 @@ try { // visibility if(C.vres > 0) { // print visibility graphically, resolution C.vres = counts/character - double dn(C.vres); + double dn(static_cast(C.vres)); oss.str(""); - oss << "\nVisibility - resolution is " << dn << " epochs = " << dn*C.gapdt + oss << "\nVisibility - resolution is " << dn << " epochs = " << dn*C.dt << " seconds.\n"; oss << " First epoch = " << printTime(firstObsTime,C.longfmt) << " and last epoch = " << printTime(lastObsTime,C.longfmt) << endl; oss << "VIS ALL "; bool isOn(false); for(k=0,i=0; i 0) { oss << string(j-k,' '); k = j; isOn = false; } - j = int(double(C.gapcount[i+1]/dn)); - if(j-k > 0) { - if(isOn) { oss << "x"; j--; } - oss << string(j-k,'X'); - k = j; + ii = int(double(C.gapcount[i]/dn)); + if(ii-k > 0) { oss << string(ii-k,' '); k = ii; isOn = false; } + ii = int(double(C.gapcount[i+1]/dn)); + if(ii-k > 0) { + if(isOn) { oss << "x"; ii--; } + oss << string(ii-k,'X'); + k = ii; isOn = true; } } @@ -1120,20 +1222,18 @@ try { // loop over sats //ostringstream ossvt; for(tabIt = table.begin(); tabIt != table.end(); ++tabIt) { - //ossvt.str(""); oss.str(""); oss << "VIS " << tabIt->sat << " "; isOn = false; bool first(true); - int jj,kk(double(tabIt->gapcount[0]/dn)); // + 0.5); + int jj,kk(static_cast(tabIt->gapcount[0]/dn)); // + 0.5); for(k=0,i=0; igapcount.size()-1; i+=2) { // satellite 'off' j = int(double(tabIt->gapcount[i]/dn)); if(!first) { vtab.insert(multimap::value_type( kk, string("-")+asString(tabIt->sat))); - //ossvt << " " << kk << "-,"; kk = j; } first = false; @@ -1147,7 +1247,6 @@ try { j = int(double(tabIt->gapcount[i+1]/dn)); vtab.insert(multimap::value_type( kk, string("+")+asString(tabIt->sat))); - //ossvt << " " << kk << "+,"; kk = j; jj = j-k; if(jj > 0) { @@ -1159,14 +1258,12 @@ try { } vtab.insert(multimap::value_type( kk, string("-")+asString(tabIt->sat))); - //oss << "-" << kk; LOG(INFO) << oss.str(); - //LOG(INFO) << ossvt.str() << " " << kk << "-"; } if(C.vistab) { LOG(INFO) << "\n Visibility Timetable - resolution is " - << dn << " epochs = " << dn*C.gapdt << " seconds.\n" + << dn << " epochs = " << dn*C.dt << " seconds.\n" << " First epoch = " << printTime(firstObsTime,C.longfmt) << " and last epoch = " << printTime(lastObsTime,C.longfmt) << "\n" << " YYYY/MM/DD HH:MM:SS = week d secs-of-wk Xtot count nX " @@ -1188,14 +1285,12 @@ try { fsat = find(sats.begin(),sats.end(),str.substr(1)); if(fsat != sats.end()) { sats.erase(fsat); - // LOG(INFO) << "Del " << str.substr(1); } - //else LOG(INFO) << "Did not find " << str.substr(1) << "!!"; } ++vt; } - ttag += (k-j)*C.gapdt*dn; + ttag += (k-j)*C.dt*dn; if(vt == vtab.end()) break; @@ -1207,7 +1302,7 @@ try { << " " << setw(5) << k*C.vres << " " << setw(3) << vt->first - k << fixed << setprecision(1) - << " " << setw(8) << (vt->first-k)*C.gapdt*dn + << " " << setw(8) << (vt->first-k)*C.dt*dn << " " << setw(5) << sats.size(); for(i=0; i 0 (user chose vis output) } - // Warnings + // output milliseconds + if(C.doms) { + C.msh.afterAddbeforeFix(); + + // true b/c no fixing, but false b/c editing commands follow + LOG(INFO) << C.msh.getFindMessage(false); + + vector cmds = C.msh.getEditCommands(); + for(i=0; i 0) { + for(i=0; i 1.e-3) LOG(INFO) << " Warning - Computed interval is " << setprecision(2) @@ -1278,14 +1397,15 @@ try { if(totvec[k] == 0) { tag = string(); if(Rhead.version < 3) { - RinexObsID obsid(sit->first+asString((sit->second)[k])); map::iterator it; for(it = Rhead.mapSysR2toR3ObsID[sit->first].begin(); it != Rhead.mapSysR2toR3ObsID[sit->first].end(); ++it) - if(it->second == obsid) { + { + if(it->second == sit->second[k]) { tag = string(", ") + it->first + string(" in ver.2"); break; } + } } LOG(INFO) << " Warning - Obs type " << sit->first << asString((sit->second)[k]) @@ -1308,3 +1428,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } } // end ProcessFiles() + +//------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------ diff --git a/ext/apps/Rinextools/msecHandler.cpp b/ext/apps/Rinextools/msecHandler.cpp new file mode 100644 index 000000000..b6d97a693 --- /dev/null +++ b/ext/apps/Rinextools/msecHandler.cpp @@ -0,0 +1,460 @@ +/// @file millisecHandler.cpp Detect and fix millisecond clock adjusts in data, +/// including pseudoranges, phases and time tags. + +#include +#include +#include +#include "GNSSconstants.hpp" +#include "TimeString.hpp" +#include "stl_helpers.hpp" // for vectorindex +#include "Stats.hpp" // for median +#include "StringUtils.hpp" + +#include "msecHandler.hpp" + +using namespace std; + +namespace gpstk { + + // ------------------------------------------------------------------------------- + const double msecHandler::Rfact = 0.001*C_MPS; // 1ms in meters + + // ------------------------------------------------------------------------------- + // empty and only constructor + msecHandler::msecHandler(void) + { + dt = -1.0; + N = 6; // default only - see setObstypes + obstypes.push_back(string("L1")); wavelengths.push_back(L1_WAVELENGTH_GPS); + obstypes.push_back(string("L2")); wavelengths.push_back(L2_WAVELENGTH_GPS); + obstypes.push_back(string("C1")); wavelengths.push_back(0.0); + obstypes.push_back(string("C2")); wavelengths.push_back(0.0); + obstypes.push_back(string("P1")); wavelengths.push_back(0.0); + obstypes.push_back(string("P2")); wavelengths.push_back(0.0); + reset(); + } + + // ------------------------------------------------------------------------------- + // Reset the object + void msecHandler::reset(void) + { + // don't reset dt + prevttag = currttag = CommonTime::BEGINNING_OF_TIME; + curr = vector< map >(N); + past = vector< map >(N); + ave = vector(N,0.0); + npt = vector(N,0); + + typesMap.clear(); + findMsg = fixMsg = string(); + + times.clear(); + nms.clear(); + ots.clear(); + adjMsgs.clear(); + badMsgs.clear(); + + doPR = false; + rmvClk = false; + } + + // ------------------------------------------------------------------------------- + // define obstypes and wavelengths; NB set wavelength(code) = 0 + void msecHandler::setObstypes(const vector& ots, + const vector& waves) + { + if(ots.size() != waves.size()) + GPSTK_THROW(Exception("Inconsistent input")); + N = ots.size(); + obstypes = ots; + wavelengths = waves; + reset(); + } + + // ------------------------------------------------------------------------------- + // add data at one epoch. May be repeated at the same epoch, but MUST be done in + // time order. NB assumes, as in RINEX, that data==0 means it is missing. + void msecHandler::add(CommonTime ttag, SatID sat, string obstype, double data) + { + if(dt == -1.0) + GPSTK_THROW(Exception("Must set nominal timestep first")); + + if(data == 0.0) return; // NB assumes, as in RINEX, that data==0 is missing. + + if(currttag == CommonTime::BEGINNING_OF_TIME) + currttag = ttag; + if(ttag != currttag) + compute(ttag); + + // first find it in obstypes + vector::const_iterator it; + it = find(obstypes.begin(),obstypes.end(),obstype); + if(it == obstypes.end()) return; // not one of the obstypes + int i = (it - obstypes.begin()); + + // store current value + curr[i][sat] = data; + // difference with past + if(past[i].find(sat) != past[i].end() // if past is there + && curr[i][sat] != 0.0 // and curr is not zero + && past[i][sat] != 0.0) // and past is not zero + { + ave[i] += curr[i][sat] - past[i][sat]; // first difference + npt[i]++; // count it + } + } + + // ------------------------------------------------------------------------------- + // After all add() calls, and before calling fix() + // @return number of fixes to apply + int msecHandler::afterAddbeforeFix(void) + { + // compute adjusts based on all the saved data + compute(CommonTime::END_OF_TIME); + + if(times.size() == 0) { + fixMsg = string("No valid adjusts found - nothing to do"); + return 0; + } + if(times.size() == 1 && rmvClk) { + rmvClk = false; + fixMsg = + string("Warning - cannot remove gross clock with only 1 ms adjust"); + } + + doPR = false; + if(find(ots[0].begin(),ots[0].end(),string("C1")) != ots[0].end() || + find(ots[0].begin(),ots[0].end(),string("C2")) != ots[0].end() || + find(ots[0].begin(),ots[0].end(),string("P1")) != ots[0].end() || + find(ots[0].begin(),ots[0].end(),string("P2")) != ots[0].end()) { + doPR = true; + fixMsg += string("Adjusts applied to pseudorange, ") + + string("so apply fix to the timetags."); + } + else fixMsg += string("Do not apply adjusts to timtags."); + + ims = ntot = 0; + tref = CommonTime::BEGINNING_OF_TIME; + + return times.size(); + } + + // ------------------------------------------------------------------------------- + // edit data by removing the millisecond adjusts, and optionally a piece-wise + // linear model of the adjusts. Must be called in time order, as add() was. + // NB may call repeatedly with the same ttag, however + // NB ttag gets fixed every call, so don't keep calling with same variable ttag. + void msecHandler::fix(CommonTime& ttag, SatID sat, string obstype, double& data) + { + // define the first linear clock + if(rmvClk && tref == CommonTime::BEGINNING_OF_TIME) { + tref = ttag; + slope = double(nms[1])/(times[1]-times[0]); + intercept = double(nms[0])-slope*(times[0]-ttag); + } + + // advance to the next ms adjust? + if(ims < times.size() && ::fabs(ttag-times[ims]) < 1.e-3) { + ntot += nms[ims]; + fixMsg += string("\nFixed ") + adjMsgs[ims]; + ims++; + if(rmvClk && ims < times.size()) { + tref = times[ims-1]; + slope = double(nms[ims])/(times[ims]-tref); + intercept = double(ntot); + } // else just leave them...extrapolation + } + + // find index and wavelength for this obstype + int index = vectorindex(obstypes,obstype); + if(index == -1) + GPSTK_THROW(Exception("Invalid obstype, internal error: "+obstype)); + double wl = wavelengths[index]; + + // remove adjusts + if(ims > 0 && ntot != 0) { + // remove adjust from the time tag + if(doPR) ttag -= ntot * 0.001; + + // remove adjust from the data + if(find(ots[ims-1].begin(), ots[ims-1].end(), obstype) != ots[ims-1].end()) + if(data != 0.0) { + data -= ntot * (wl == 0.0 ? Rfact : Rfact/wl); + } + } + + // remove gross (piece-wise linear) clock by adjusting time tags and all data + if(rmvClk) { + // compute the model at this time + double dtot = (intercept + slope*(ttag-tref))*Rfact; + ttag += dtot/C_MPS; + if(wl != 0.0) dtot /= wl; + if(data != 0.0) data += dtot; + } + } + + // ------------------------------------------------------------------------------- + // get messages generated during detection phase + string msecHandler::getFindMessage(bool verbose) + { + size_t i; + findMsg = string(); + + findMsg += string("Searched for millisecond adjusts on obs types:"); + for(i=0; i::iterator tit=typesMap.begin(); tit!=typesMap.end(); ++tit) + findMsg += string("\n Found ") + + StringUtils::asString(tit->second) + string(" adjusts for ") + + tit->first; + + if(typesMap.size() > 1) + findMsg += string("\n Warning - detected millisecond adjusts are not ") + + string("consistently applied to the observables."); + + if(adjMsgs.size() > 0 && badMsgs.size() > adjMsgs.size()/2) + findMsg += string("\n Warning - millisecond adjust detection seems to be ") + + string("of poor quality - consider rerunning with option --noMS"); + + if(verbose) { + for(i=0; i of valid adjusts + map msecHandler::getAdjusts(void) + { + map adjusts; + for(unsigned int i=0; i::value_type(times[i],nms[i])); + + return adjusts; + } + + // ------------------------------------------------------------------------------- + // compute - pass it the upcoming ttag + // NB. ineq1620.14o - trimble has 2 and 3 ms adjusts + void msecHandler::compute(CommonTime ttag) + { + size_t i,j; + int ii,in,nadj; + static CommonTime lastttag(CommonTime::BEGINNING_OF_TIME); + const static double mstol(0.2); + + if(prevttag != CommonTime::BEGINNING_OF_TIME) { + // convert to millisecs and compute averages + for(i=0; i 0) + ave[i] *= 1000.0/(npt[i]*C_MPS); // form average and convert to ms + else + ave[i] = 0.0; + } + + // do for time tag as well + double del = dt-(currttag-prevttag); + del = ::fmod(del,dt); + del *= 1000.0; + + // round to nearest integer ms + vector iave(N+1); // element [N] is timetag + for(i=0; i=0.0 ? 0.5:-0.5)); + iave[N] = (del+(del>0.0 ? 0.5:-0.5)); // N is timetag + + // test - is there an adjust? are the non-zero number-of-ms consistent? + bool adj(false),consist(true),adjPh(false),adjPR(false); + nadj = 0; // the adjust + for(i=0; i deltas; + map::const_iterator it; + + // collect the differences, one per sat + for(it = curr[i].begin(); it != curr[i].end(); ++it) { + if(past[i].find(it->first) != past[i].end()) { + // diff for this sat in ms + del = (curr[i][it->first] - past[i][it->first]) + / (Rfact/wavelengths[i]); + deltas.push_back(del); + } + } + // get the median, an outlier will not affect this + med = median(deltas); + // compute abs(deviation from median) + for(j=0; j(deltas); + // replace average with median, which will be insensitive to outliers + if(mad < 0.5) { + ave[i] = med; + iave[i] = int(ave[i]+(ave[i]>=0.0 ? 0.5:-0.5)); + } + if(iave[i] != 0) foundPhase=true; + } + + // fix it - duplicate code above + if(!foundPhase) { + adj = false; consist = true; adjPh = false; nadj = 0; + for(i=0; i mstol || npt[0] < 3) { + conmsg = string(" not well determined"); + consist = false; + } + + // are they consistent? is phase consistent with code? + ostringstream oss; + in=-1; bool onphase(false); + for(i=0; i no,ot; + if(iave[N] == 0) no.push_back("TT"); + else ot.push_back("TT"); + oss << (iave[N]==0 ? "!":"") << "TT"; + for(i=0; i::value_type(types,0)); + typesMap[types]++; + + adjMsgs.push_back(oss.str()); + + // RinEdit commands + for(i=0; i 2) { + oss << obstypes[i][0] << "," << obstypes[i].substr(1); + } + else { + oss << "G" << obstypes[i]; + } + oss << printTime(currttag,",%F,%.3g"); + oss << "," << fixed << setprecision(5) << - double(nadj) + * (wavelengths[i] == 0.0 ? Rfact : Rfact/wavelengths[i]) + << " # edit cmd for " << nadj << " millisecond adjust"; + + editCmds.push_back(oss.str()); + } + } + else { // not a valid adjust + badMsgs.push_back(oss.str()); + } + } + } // end if prevttag != BEGIN + + // prepare for next epoch + prevttag = currttag; + currttag = ttag; + for(i=0; i(N,0.0); + npt = vector(N,0); + + } // end void compute(ttag) + +} // end namespace diff --git a/ext/apps/Rinextools/msecHandler.hpp b/ext/apps/Rinextools/msecHandler.hpp new file mode 100644 index 000000000..21813434d --- /dev/null +++ b/ext/apps/Rinextools/msecHandler.hpp @@ -0,0 +1,144 @@ +/// @file millisecHandler.hpp Detect and fix millisecond clock adjusts in data, +/// including pseudoranges, phases and time tags. + +#ifndef GPSTK_MSHANDLER_INCLUDE +#define GPSTK_MSHANDLER_INCLUDE + +#include +#include +#include + +#include "Exception.hpp" +#include "CommonTime.hpp" +#include "SatID.hpp" + +namespace gpstk { + +// TD bool rmvClk; ///< NB currently hardcoded false + +// ------------------------------------------------------------------------------- +/// Class to detect, validate and remove millisecond clock adjusts from pseudorange +/// and phase data and timetags. Caller passes all the data to the object, in time +/// order, and the object detects where (in time and in observables) there are +/// millisecond adjusts. Caller can then pass data to the object again and have it +/// remove the appropriate adjusts from pseudorange, phase and/or timetags. +/// NB. adjusts should be removed from pseudorange and timetags together. +/// NB. most adjusted data has jumps in pseudorange, but not phase (violates RINEX!) +/// although the opposite (found in phase, but not pseudorange) does exist (job3326). +/// NB. some (Ashtech) usually also have jumps in the time tags; Trimble is variable. +class msecHandler +{ +private: + // member data + double dt; ///< nominal time spacing + + // estimation + int N; ///< number of obstypes (6) + std::vector obstypes; ///< obstypes to monitor (L1 L2 C1 C2 P1 P2) + std::vector wavelengths; ///< wavelengths of obstypes - 0 for code + CommonTime prevttag, currttag; ///< for tracking timetags internally + // keep the following parallel + std::vector< std::map > curr, past; ///< storing data internally + std::vector ave; ///< average step per obstypes + std::vector npt; ///< number of data per obstypes + + // consistency of adjusts + // record results; typesMap = count adjusts/unique set obs types, should be only 1 + std::map typesMap; ///< [string "P1 C2 !L1 !L2"] = number of adj + + // messages to pass back + std::string findMsg,fixMsg; + + // the adjusts - keep these parallel + std::vector times; ///< time of adjust + std::vector nms; ///< number of ms + std::vector< std::vector > ots; ///< ots that jump + std::vector adjMsgs; ///< adjust summary (i/o) + std::vector editCmds; ///< adjust editing cmds + std::vector badMsgs; ///< bad ones + + // fixing + bool doPR; ///< if adjusts appear in pseudorange, fix time tags also + int ims,ntot; ///< internal bookkeeping on which adjust, total ms adjust + + // piece-wise linear clock model + bool rmvClk; ///< NB currently hardcoded false + double intercept, slope; ///< the piece-wise linear model + CommonTime tref; ///< reference time for the linear models + + //static const double wl1, wl2; + static const double Rfact;//, L1fact, L2fact; ///< one ms in m,L1cyc,L2cyc + + /// compute average differences and detect adjusts. call after all input at one + /// time is done, passing it the _next_ timetag. + /// @param ttag the next time + void compute(CommonTime ttag); + +public: + /// empty and only constructor - note that setDT() must be called before processing + msecHandler(void); + + /// Reset the object + void reset(void); + + /// Re-define obstypes and wavelengths with parallel arrays. + /// NB must set wavelength(code) = 0. + /// @param ots vector of obstypes to be passed to add() and fix(). + /// @param waves vector wavelength of phases in ots or zero for codes. + void setObstypes(const std::vector& ots, + const std::vector& waves); + + /// Get the obstypes used in the detector + std::vector getObsTypes(void) { + std::vector ots = obstypes; + return ots; + } + + /// must set the nominal timestep before any add() or fix() + void setDT(double dt_in) { dt = dt_in; } + + /// add data at one epoch. May be repeated at the same epoch, but MUST be done in + /// time order. NB assumes, as in RINEX, that data==0 means it is missing. + /// @param ttag time of the data + /// @param sat satellite of the data + /// @param obstype string observation type of the data (L1 L2 C1 C2 P1 P2) + /// @param data value of obstype for sat at ttag + void add(CommonTime ttag, SatID sat, std::string obstype, double data); + + /// After all add() calls, and before calling fix() + /// @return number of fixes to apply + int afterAddbeforeFix(void); + + /// edit data by removing the millisecond adjusts, and optionally a piece-wise + /// linear model of the adjusts. Must be called in time order, as add() was. + /// NB may call repeatedly with the same ttag, however + /// NB ttag gets fixed every call, so don't keep calling with same variable ttag. + /// @param ttag time of the data + /// @param sat satellite of the data + /// @param obstype string observation type of the data (L1 L2 C1 C2 P1 P2) + /// @param data value of obstype for sat at ttag + void fix(CommonTime& ttag, SatID sat, std::string obstype, double& data); + + /// get messages generated during detection phase + std::string getFindMessage(bool verbose=false); + + /// get find message in the form of editing commands for EditRinex + std::vector getEditCommands(void) { return editCmds; } + + /// get messages generated during fixing phase + std::string getFixMessage(bool verbose=false) { return fixMsg; } + + /// get number of valid adjusts found + int getNMS(void) { return times.size(); } + + /// get the number of invalid adjusts found + int getNbadMS(void) { return badMsgs.size(); } + + /// get map of valid adjusts; should parallel getFindMessage() + std::map getAdjusts(void); + +}; // end class msecHandler + +} // end namespace + +#endif // GPSTK_MSHANDLER_INCLUDE diff --git a/ext/apps/checktools/CMakeLists.txt b/ext/apps/checktools/CMakeLists.txt index 41b60b8ab..df018f903 100755 --- a/ext/apps/checktools/CMakeLists.txt +++ b/ext/apps/checktools/CMakeLists.txt @@ -2,13 +2,16 @@ add_executable(rowcheck rowcheck.cpp) target_link_libraries(rowcheck gpstk) -install (TARGETS rowcheck DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rowcheck DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rowcheckTest rowcheck) add_executable(rmwcheck rmwcheck.cpp) target_link_libraries(rmwcheck gpstk) -install (TARGETS rmwcheck DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rmwcheck DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rmwcheckTest rmwcheck) add_executable(rnwcheck rnwcheck.cpp) target_link_libraries(rnwcheck gpstk) -install (TARGETS rnwcheck DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rnwcheck DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rnwcheckTest rnwcheck) diff --git a/ext/apps/checktools/rmwcheck.cpp b/ext/apps/checktools/rmwcheck.cpp index 1aeea7106..c7a19becc 100644 --- a/ext/apps/checktools/rmwcheck.cpp +++ b/ext/apps/checktools/rmwcheck.cpp @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/checktools/rnwcheck.cpp b/ext/apps/checktools/rnwcheck.cpp index 676506c0e..6ffc18cb0 100644 --- a/ext/apps/checktools/rnwcheck.cpp +++ b/ext/apps/checktools/rnwcheck.cpp @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/checktools/rowcheck.cpp b/ext/apps/checktools/rowcheck.cpp index 6602d9149..adfeb9744 100644 --- a/ext/apps/checktools/rowcheck.cpp +++ b/ext/apps/checktools/rowcheck.cpp @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/clocktools/CMakeLists.txt b/ext/apps/clocktools/CMakeLists.txt index c37303f97..af5bf08d3 100755 --- a/ext/apps/clocktools/CMakeLists.txt +++ b/ext/apps/clocktools/CMakeLists.txt @@ -2,55 +2,56 @@ add_executable(rmoutlier rmoutlier.cpp) target_link_libraries(rmoutlier gpstk) -install (TARGETS rmoutlier DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rmoutlier DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rmoutlierTest rmoutlier -h) add_executable(dallandev dallandev.cpp) target_link_libraries(dallandev gpstk) -install (TARGETS dallandev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS dallandev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(ffp ffp.cpp) target_link_libraries(ffp gpstk) -install (TARGETS ffp DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS ffp DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(mallandev mallandev.cpp) target_link_libraries(mallandev gpstk) -install (TARGETS mallandev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mallandev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(nallandev nallandev.cpp) target_link_libraries(nallandev gpstk) -install (TARGETS nallandev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS nallandev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(oallandev oallandev.cpp) target_link_libraries(oallandev gpstk) -install (TARGETS oallandev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS oallandev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(ohadamarddev ohadamarddev.cpp) target_link_libraries(ohadamarddev gpstk) -install (TARGETS ohadamarddev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS ohadamarddev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(ORDPhaseParser ORDPhaseParser.cpp) target_link_libraries(ORDPhaseParser gpstk) -install (TARGETS ORDPhaseParser DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS ORDPhaseParser DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(pff pff.cpp) target_link_libraries(pff gpstk) -install (TARGETS pff DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS pff DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(scale scale.cpp) target_link_libraries(scale gpstk) -install (TARGETS scale DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS scale DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(tallandev tallandev.cpp) target_link_libraries(tallandev gpstk) -install (TARGETS tallandev DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS tallandev DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(TIAPhaseParser TIAPhaseParser.cpp) target_link_libraries(TIAPhaseParser gpstk) -install (TARGETS TIAPhaseParser DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS TIAPhaseParser DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(trunc trunc.cpp) target_link_libraries(trunc gpstk) -install (TARGETS trunc DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS trunc DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) install( PROGRAMS allanplot DESTINATION "${CMAKE_INSTALL_BINDIR}" ) install( FILES allanplot.py DESTINATION "${CMAKE_INSTALL_BINDIR}" ) diff --git a/ext/apps/converters/CMakeLists.txt b/ext/apps/converters/CMakeLists.txt index e5829da87..db0decb9c 100755 --- a/ext/apps/converters/CMakeLists.txt +++ b/ext/apps/converters/CMakeLists.txt @@ -2,7 +2,8 @@ add_executable(novaRinex novaRinex.cpp) target_link_libraries(novaRinex gpstk) -install (TARGETS novaRinex DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS novaRinex DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(novaRinexTest novaRinex) diff --git a/ext/apps/converters/novaRinex.cpp b/ext/apps/converters/novaRinex.cpp index 2b9e8c0b3..7aacff4e0 100644 --- a/ext/apps/converters/novaRinex.cpp +++ b/ext/apps/converters/novaRinex.cpp @@ -306,7 +306,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -374,7 +374,7 @@ try { rnh.valid |= RinexNavHeader::commentValid; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -475,7 +475,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -504,7 +504,7 @@ try { #endif } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -632,7 +632,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1050,7 +1050,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1113,7 +1113,7 @@ try { else Args.push_back(arg); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1159,7 +1159,7 @@ try { ofs << "End of command line input summary." << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/differential/CMakeLists.txt b/ext/apps/differential/CMakeLists.txt index 7ee38458b..c118279e5 100755 --- a/ext/apps/differential/CMakeLists.txt +++ b/ext/apps/differential/CMakeLists.txt @@ -2,4 +2,5 @@ add_executable(vecsol vecsol.cpp) target_link_libraries(vecsol gpstk) -install (TARGETS vecsol DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS vecsol DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(vecsolTest vecsol) diff --git a/ext/apps/difftools/CMakeLists.txt b/ext/apps/difftools/CMakeLists.txt index e3d09d7d4..573a9e300 100755 --- a/ext/apps/difftools/CMakeLists.txt +++ b/ext/apps/difftools/CMakeLists.txt @@ -2,15 +2,18 @@ add_executable(rowdiff rowdiff.cpp) target_link_libraries(rowdiff gpstk) -install (TARGETS rowdiff DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rowdiff DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rowdiffTest rowdiff) add_executable(rnwdiff rnwdiff.cpp) target_link_libraries(rnwdiff gpstk) -install (TARGETS rnwdiff DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rnwdiff DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rnwdiffTest rnwdiff) add_executable(rmwdiff rmwdiff.cpp) target_link_libraries(rmwdiff gpstk) -install (TARGETS rmwdiff DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rmwdiff DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rmwdiffTest rmwdiff) diff --git a/ext/apps/difftools/rmwdiff.cpp b/ext/apps/difftools/rmwdiff.cpp index cd233ad06..7e7ec0fbd 100644 --- a/ext/apps/difftools/rmwdiff.cpp +++ b/ext/apps/difftools/rmwdiff.cpp @@ -174,7 +174,7 @@ void RMWDiff::process() << endl << "Terminating.." << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl << endl @@ -203,7 +203,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/difftools/rnwdiff.cpp b/ext/apps/difftools/rnwdiff.cpp index 6674a086a..8ca2363fc 100644 --- a/ext/apps/difftools/rnwdiff.cpp +++ b/ext/apps/difftools/rnwdiff.cpp @@ -159,7 +159,7 @@ void RNWDiff::process() << endl << "Terminating.." << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl << endl @@ -187,7 +187,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/difftools/rowdiff.cpp b/ext/apps/difftools/rowdiff.cpp index 3dc28b6e0..2cbdb1a9d 100644 --- a/ext/apps/difftools/rowdiff.cpp +++ b/ext/apps/difftools/rowdiff.cpp @@ -232,7 +232,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/filetools/CMakeLists.txt b/ext/apps/filetools/CMakeLists.txt index 0cfba9c04..04077106a 100755 --- a/ext/apps/filetools/CMakeLists.txt +++ b/ext/apps/filetools/CMakeLists.txt @@ -2,18 +2,22 @@ add_executable(glodump GloDump.cpp) target_link_libraries(glodump gpstk) -install (TARGETS glodump DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS glodump DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(glodumpTest glodump) add_executable(rinexthin RinexThin.cpp) target_link_libraries(rinexthin gpstk) -install (TARGETS rinexthin DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rinexthin DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rinexthinTest rinexthin) add_executable(sp3version sp3version.cpp) target_link_libraries(sp3version gpstk) -install (TARGETS sp3version DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS sp3version DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(sp3versionTest sp3version) add_executable(bc2sp3 bc2sp3.cpp) target_link_libraries(bc2sp3 gpstk) -install (TARGETS bc2sp3 DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS bc2sp3 DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(bc2sp3Test bc2sp3) diff --git a/ext/apps/geomatics/JPLeph/CMakeLists.txt b/ext/apps/geomatics/JPLeph/CMakeLists.txt index aba04070d..cae295896 100755 --- a/ext/apps/geomatics/JPLeph/CMakeLists.txt +++ b/ext/apps/geomatics/JPLeph/CMakeLists.txt @@ -2,10 +2,12 @@ add_executable(convertSSEph convertSSEph.cpp) target_link_libraries(convertSSEph gpstk) -install (TARGETS convertSSEph DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS convertSSEph DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(convertSSEphTest convertSSEph) add_executable(testSSEph testSSEph.cpp) target_link_libraries(testSSEph gpstk) -install (TARGETS testSSEph DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS testSSEph DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(testSSEphTest testSSEph) diff --git a/ext/apps/geomatics/cycleslips/CMakeLists.txt b/ext/apps/geomatics/cycleslips/CMakeLists.txt index 42bd896cc..b0aa6a0a9 100755 --- a/ext/apps/geomatics/cycleslips/CMakeLists.txt +++ b/ext/apps/geomatics/cycleslips/CMakeLists.txt @@ -2,6 +2,7 @@ add_executable(DiscFix DiscFix.cpp) target_link_libraries(DiscFix gpstk) -install (TARGETS DiscFix DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS DiscFix DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(DiscFixTest DiscFix) diff --git a/ext/apps/geomatics/cycleslips/DiscFix.cpp b/ext/apps/geomatics/cycleslips/DiscFix.cpp index 5dfd9cf1e..953b43080 100644 --- a/ext/apps/geomatics/cycleslips/DiscFix.cpp +++ b/ext/apps/geomatics/cycleslips/DiscFix.cpp @@ -395,7 +395,7 @@ int ReadFile(int nfile) throw(Exception) return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -558,7 +558,7 @@ int ProcessOneEntireEpoch(RinexObsData& roe) throw(Exception) return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -628,7 +628,7 @@ int ProcessOneSatOneEpoch(GSatID sat, CommonTime tt, unsigned short& flag, } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -692,7 +692,7 @@ void ProcessSatPass(int in) throw(Exception) // status == 100 means 'failed' } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -731,7 +731,7 @@ int AfterReadingFiles(void) throw(Exception) return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -776,7 +776,7 @@ void WriteToRINEXfile(void) throw(Exception) WriteRINEXdata(WriteEpoch,targetTime); } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -842,7 +842,7 @@ void WriteRINEXheader(void) throw(Exception) orfstr << rheadout; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -964,7 +964,7 @@ void WriteRINEXdata(CommonTime& WriteEpoch, const CommonTime targetTime) throw(E } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1540,7 +1540,7 @@ int GetCommandLine(int argc, char **argv) throw(Exception) } // end try catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1622,7 +1622,7 @@ void PreProcessArgs(const char *arg, vector& Args) throw(Exception) //if(debug) cout << "arg " << string(arg) << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/kalman/CMakeLists.txt b/ext/apps/geomatics/kalman/CMakeLists.txt index 2f607fb86..09254be11 100755 --- a/ext/apps/geomatics/kalman/CMakeLists.txt +++ b/ext/apps/geomatics/kalman/CMakeLists.txt @@ -2,9 +2,11 @@ add_executable(mergeSRI mergeSRI.cpp) target_link_libraries(mergeSRI gpstk) -install (TARGETS mergeSRI DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mergeSRI DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(mergeSRITest mergeSRI) add_executable(tkalm tkalm.cpp) target_link_libraries(tkalm gpstk) -install (TARGETS tkalm DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS tkalm DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(tkalmTest tkalm) diff --git a/ext/apps/geomatics/relposition/CMakeLists.txt b/ext/apps/geomatics/relposition/CMakeLists.txt index a44ca0500..aa3544055 100755 --- a/ext/apps/geomatics/relposition/CMakeLists.txt +++ b/ext/apps/geomatics/relposition/CMakeLists.txt @@ -24,7 +24,8 @@ target_link_libraries(baselib gpstk) add_executable(DDBase DDBase.cpp) target_link_libraries(DDBase baselib) -install (TARGETS DDBase DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS DDBase DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(DDBaseTest DDBase) diff --git a/ext/apps/geomatics/relposition/ClockModel.cpp b/ext/apps/geomatics/relposition/ClockModel.cpp index 8d41ef98a..f4c68fd1b 100644 --- a/ext/apps/geomatics/relposition/ClockModel.cpp +++ b/ext/apps/geomatics/relposition/ClockModel.cpp @@ -84,7 +84,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end ClockModel() @@ -172,7 +172,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end RemoveClockJumps() diff --git a/ext/apps/geomatics/relposition/CommandInput.cpp b/ext/apps/geomatics/relposition/CommandInput.cpp index 3e9a8102d..2c9b3bdc7 100644 --- a/ext/apps/geomatics/relposition/CommandInput.cpp +++ b/ext/apps/geomatics/relposition/CommandInput.cpp @@ -137,7 +137,7 @@ try { OutputDDRFile = string(""); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1063,7 +1063,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1147,7 +1147,7 @@ try { else Args.push_back(arg); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1351,7 +1351,7 @@ try { return (ok ? 0 : 1); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1489,7 +1489,7 @@ try { ofs << "End of command line input summary." << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/ComputeRAIMSolution.cpp b/ext/apps/geomatics/relposition/ComputeRAIMSolution.cpp index da03ec253..68acc0447 100644 --- a/ext/apps/geomatics/relposition/ComputeRAIMSolution.cpp +++ b/ext/apps/geomatics/relposition/ComputeRAIMSolution.cpp @@ -169,7 +169,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end ComputeRAIMSolution() @@ -194,7 +194,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/Configure.cpp b/ext/apps/geomatics/relposition/Configure.cpp index 9ca62a710..8907c7c09 100644 --- a/ext/apps/geomatics/relposition/Configure.cpp +++ b/ext/apps/geomatics/relposition/Configure.cpp @@ -84,7 +84,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end Configure() @@ -235,7 +235,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -286,7 +286,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/DataOutput.cpp b/ext/apps/geomatics/relposition/DataOutput.cpp index f438a6679..6bf94e140 100644 --- a/ext/apps/geomatics/relposition/DataOutput.cpp +++ b/ext/apps/geomatics/relposition/DataOutput.cpp @@ -128,7 +128,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end OutputRawData() @@ -212,7 +212,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end OutputRawDData() @@ -277,7 +277,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end OutputDDData() @@ -332,7 +332,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end OutputClockData() diff --git a/ext/apps/geomatics/relposition/DataStructures.cpp b/ext/apps/geomatics/relposition/DataStructures.cpp index e47e1b159..1c885418c 100644 --- a/ext/apps/geomatics/relposition/DataStructures.cpp +++ b/ext/apps/geomatics/relposition/DataStructures.cpp @@ -65,7 +65,7 @@ try { return SL[label]; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/DoubleDifference.cpp b/ext/apps/geomatics/relposition/DoubleDifference.cpp index 10d7d12fa..d84fa1255 100644 --- a/ext/apps/geomatics/relposition/DoubleDifference.cpp +++ b/ext/apps/geomatics/relposition/DoubleDifference.cpp @@ -152,7 +152,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end DoubleDifference() @@ -246,7 +246,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -427,7 +427,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/EditDDs.cpp b/ext/apps/geomatics/relposition/EditDDs.cpp index 660002d35..c48fb36e1 100644 --- a/ext/apps/geomatics/relposition/EditDDs.cpp +++ b/ext/apps/geomatics/relposition/EditDDs.cpp @@ -269,7 +269,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end EditDDs() @@ -345,7 +345,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -390,7 +390,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -585,7 +585,7 @@ try { return -1; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -783,7 +783,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/EditRawDataBuffers.cpp b/ext/apps/geomatics/relposition/EditRawDataBuffers.cpp index 4adc49d23..ac93cdbff 100644 --- a/ext/apps/geomatics/relposition/EditRawDataBuffers.cpp +++ b/ext/apps/geomatics/relposition/EditRawDataBuffers.cpp @@ -167,7 +167,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -232,7 +232,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/ElevationMask.cpp b/ext/apps/geomatics/relposition/ElevationMask.cpp index 789184db7..7e87bcdfb 100644 --- a/ext/apps/geomatics/relposition/ElevationMask.cpp +++ b/ext/apps/geomatics/relposition/ElevationMask.cpp @@ -73,7 +73,7 @@ try { return false; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end ElevationMask @@ -91,7 +91,7 @@ try { return ( RotatedAntennaElevation(elevation, azimuth) >= ElevCutoff ); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -128,7 +128,7 @@ try { return elevation; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end RotatedAntennaElevation diff --git a/ext/apps/geomatics/relposition/EphemerisImprovement.cpp b/ext/apps/geomatics/relposition/EphemerisImprovement.cpp index 493e932a0..93828e802 100644 --- a/ext/apps/geomatics/relposition/EphemerisImprovement.cpp +++ b/ext/apps/geomatics/relposition/EphemerisImprovement.cpp @@ -144,6 +144,6 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end EphemerisImprovement() diff --git a/ext/apps/geomatics/relposition/Estimation.cpp b/ext/apps/geomatics/relposition/Estimation.cpp index 1e4cc6863..befcef3cc 100644 --- a/ext/apps/geomatics/relposition/Estimation.cpp +++ b/ext/apps/geomatics/relposition/Estimation.cpp @@ -277,7 +277,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end Estimation() @@ -312,7 +312,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -391,7 +391,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -449,7 +449,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -507,7 +507,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -563,7 +563,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -739,7 +739,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -781,7 +781,7 @@ try { return i; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -955,7 +955,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -971,7 +971,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -992,7 +992,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1041,7 +1041,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1118,7 +1118,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1181,7 +1181,7 @@ try { return done; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1198,7 +1198,7 @@ try { + asString(sat1) + string("-") + asString(sat2) ); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } //------------------------------------------------------------------------------------ @@ -1219,7 +1219,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } //------------------------------------------------------------------------------------ @@ -1242,7 +1242,7 @@ try { //oflog << " " << sat2 << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1378,7 +1378,7 @@ try { << " used in estimation." << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1468,7 +1468,7 @@ try { return rms; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/ProcessRawData.cpp b/ext/apps/geomatics/relposition/ProcessRawData.cpp index f329caf09..d8989ee0c 100644 --- a/ext/apps/geomatics/relposition/ProcessRawData.cpp +++ b/ext/apps/geomatics/relposition/ProcessRawData.cpp @@ -158,7 +158,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end ProcessRawData @@ -242,7 +242,7 @@ try { } // end loop over sats } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end FillRawData() @@ -291,7 +291,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -327,7 +327,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end EditRawData() @@ -384,7 +384,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/ReadObsFiles.cpp b/ext/apps/geomatics/relposition/ReadObsFiles.cpp index 331dc7baa..fec3111f5 100644 --- a/ext/apps/geomatics/relposition/ReadObsFiles.cpp +++ b/ext/apps/geomatics/relposition/ReadObsFiles.cpp @@ -219,7 +219,7 @@ try { } // end loop over input observation files } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -278,7 +278,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/ReadRawData.cpp b/ext/apps/geomatics/relposition/ReadRawData.cpp index 97aaa616a..24060e026 100644 --- a/ext/apps/geomatics/relposition/ReadRawData.cpp +++ b/ext/apps/geomatics/relposition/ReadRawData.cpp @@ -277,7 +277,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end ReadAndProcessRawData() @@ -331,7 +331,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -371,7 +371,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/StochasticModels.cpp b/ext/apps/geomatics/relposition/StochasticModels.cpp index 87d6b9a7f..378228d3d 100644 --- a/ext/apps/geomatics/relposition/StochasticModels.cpp +++ b/ext/apps/geomatics/relposition/StochasticModels.cpp @@ -124,7 +124,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -158,7 +158,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -263,7 +263,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/Synchronization.cpp b/ext/apps/geomatics/relposition/Synchronization.cpp index 3c8222071..0a07615b4 100644 --- a/ext/apps/geomatics/relposition/Synchronization.cpp +++ b/ext/apps/geomatics/relposition/Synchronization.cpp @@ -110,7 +110,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end Synchronization() @@ -301,7 +301,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end FitPhaseAndMoveData @@ -407,7 +407,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/relposition/Timetable.cpp b/ext/apps/geomatics/relposition/Timetable.cpp index d301b9381..e65e1bdba 100644 --- a/ext/apps/geomatics/relposition/Timetable.cpp +++ b/ext/apps/geomatics/relposition/Timetable.cpp @@ -116,7 +116,7 @@ bool decreasingMetricSort(const TTSegment& left, const TTSegment& right); int QueryTimeTable(SDid& sdid, CommonTime& tt) throw(Exception) { try { - int ntt(0.5+(tt-FirstEpoch)/CI.DataInterval); + int ntt(static_cast(0.5+(tt-FirstEpoch)/CI.DataInterval)); // loop over the timetable, looking for a match : baseline and time list::iterator ttit; for(ttit=TimeTable.begin(); ttit != TimeTable.end(); ttit++) { @@ -133,7 +133,7 @@ try { return 1; // failure } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -158,7 +158,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -261,7 +261,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // end Timetable() @@ -329,7 +329,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -387,7 +387,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -504,7 +504,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -794,7 +794,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -842,7 +842,7 @@ try { return os; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/geomatics/robust/CMakeLists.txt b/ext/apps/geomatics/robust/CMakeLists.txt index 3ea9d92ba..1869718fc 100755 --- a/ext/apps/geomatics/robust/CMakeLists.txt +++ b/ext/apps/geomatics/robust/CMakeLists.txt @@ -2,9 +2,11 @@ add_executable(lsfilt lsfilt.cpp) target_link_libraries(lsfilt gpstk) -install (TARGETS lsfilt DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS lsfilt DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(lsfiltTest lsfilt) add_executable(rstats rstats.cpp) target_link_libraries(rstats gpstk) -install (TARGETS rstats DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rstats DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rstatsTest rstats) diff --git a/ext/apps/geomatics/robust/lsfilt.cpp b/ext/apps/geomatics/robust/lsfilt.cpp index 45bbbf99e..23bf62fa7 100644 --- a/ext/apps/geomatics/robust/lsfilt.cpp +++ b/ext/apps/geomatics/robust/lsfilt.cpp @@ -107,7 +107,7 @@ int lsfilterCoefficients(double* c, int nl, int nr, int poly, int lderiv) return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: " + string(e.what())); GPSTK_THROW(E); } @@ -341,7 +341,7 @@ int main(int argc, char **argv) return 0; } catch(Exception& e) { cout << "GPSTk Exception : " << e.what(); } - catch(exception& e) { cout << "standard exception : " << e.what(); } + catch(std::exception& e) { cout << "standard exception : " << e.what(); } catch (...) { cout << "Unknown error." << endl; } return -1; } // end main() diff --git a/ext/apps/geomatics/robust/rstats.cpp b/ext/apps/geomatics/robust/rstats.cpp index 77ec31155..1bd39e788 100644 --- a/ext/apps/geomatics/robust/rstats.cpp +++ b/ext/apps/geomatics/robust/rstats.cpp @@ -612,7 +612,7 @@ int main(int argc, char **argv) return 0; } catch(Exception& e) { cout << "GPSTk Exception : " << e.what(); } - catch(exception& e) { cout << "standard exception : " << e.what(); } + catch(std::exception& e) { cout << "standard exception : " << e.what(); } catch (...) { cout << "Unknown error." << endl; } return -1; } // end main() diff --git a/ext/apps/mergetools/CMakeLists.txt b/ext/apps/mergetools/CMakeLists.txt index e8bb182ee..8da307740 100755 --- a/ext/apps/mergetools/CMakeLists.txt +++ b/ext/apps/mergetools/CMakeLists.txt @@ -3,15 +3,18 @@ add_executable(mergeRinObs mergeRinObs.cpp) target_link_libraries(mergeRinObs gpstk) -install (TARGETS mergeRinObs DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mergeRinObs DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(mergeRinObsTest mergeRinObs) add_executable(mergeRinNav mergeRinNav.cpp) target_link_libraries(mergeRinNav gpstk) -install (TARGETS mergeRinNav DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mergeRinNav DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(mergeRinNavTest mergeRinNav) add_executable(mergeRinMet mergeRinMet.cpp) target_link_libraries(mergeRinMet gpstk) -install (TARGETS mergeRinMet DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mergeRinMet DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(mergeRinMetTest mergeRinMet) if (CMAKE_SYSTEM_NAME MATCHES "SunOS") target_link_libraries(mergeRinObs gen) diff --git a/ext/apps/mergetools/mergeRinMet.cpp b/ext/apps/mergetools/mergeRinMet.cpp index 086480c30..373bc847c 100644 --- a/ext/apps/mergetools/mergeRinMet.cpp +++ b/ext/apps/mergetools/mergeRinMet.cpp @@ -106,7 +106,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/mergetools/mergeRinNav.cpp b/ext/apps/mergetools/mergeRinNav.cpp index 3d0981609..f402fca4f 100644 --- a/ext/apps/mergetools/mergeRinNav.cpp +++ b/ext/apps/mergetools/mergeRinNav.cpp @@ -109,7 +109,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/mergetools/mergeRinObs.cpp b/ext/apps/mergetools/mergeRinObs.cpp index 6e84cc2c4..44bfc3afb 100644 --- a/ext/apps/mergetools/mergeRinObs.cpp +++ b/ext/apps/mergetools/mergeRinObs.cpp @@ -109,7 +109,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/misc/CMakeLists.txt b/ext/apps/misc/CMakeLists.txt new file mode 100755 index 000000000..fdbd17b39 --- /dev/null +++ b/ext/apps/misc/CMakeLists.txt @@ -0,0 +1,5 @@ +# apps/misc/CMakeLists.txt + +add_executable(xSVNumXRef xSVNumXRef.cpp) +target_link_libraries(xSVNumXRef gpstk) +install (TARGETS xSVNumXRef DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/ext/apps/misc/xSVNumXRef.cpp b/ext/apps/misc/xSVNumXRef.cpp new file mode 100644 index 000000000..b0921abaf --- /dev/null +++ b/ext/apps/misc/xSVNumXRef.cpp @@ -0,0 +1,20 @@ +/********************************************************************* +* +* Demo program for gpstk/core/lib/GNSSCore/SVNumXRef. +* +*********************************************************************/ +#include +#include "SVNumXRef.hpp" + +using namespace std; +using namespace gpstk; + +int main( int argc, char * argv[] ) +{ + cout << "Entering xSVNumXRef" << endl; + + SVNumXRef svNumXRef; + svNumXRef.dump(cout, true); + + return(0); +} diff --git a/ext/apps/multipath/CMakeLists.txt b/ext/apps/multipath/CMakeLists.txt index fc1d18769..e9b00c2fe 100755 --- a/ext/apps/multipath/CMakeLists.txt +++ b/ext/apps/multipath/CMakeLists.txt @@ -3,5 +3,6 @@ add_executable(mpsolve mpsolve.cpp ObsArray.cpp) target_link_libraries(mpsolve gpstk) -install (TARGETS mpsolve DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS mpsolve DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(mpsolveTest mpsolve) diff --git a/ext/apps/positioning/CMakeLists.txt b/ext/apps/positioning/CMakeLists.txt index 5b7fd8510..98a5aa7fd 100755 --- a/ext/apps/positioning/CMakeLists.txt +++ b/ext/apps/positioning/CMakeLists.txt @@ -2,13 +2,16 @@ add_executable(poscvt poscvt.cpp) target_link_libraries(poscvt gpstk) -install (TARGETS poscvt DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS poscvt DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(poscvtTest poscvt) add_executable(PRSolve PRSolve.cpp) target_link_libraries(PRSolve gpstk) -install (TARGETS PRSolve DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS PRSolve DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(PRSolveTest PRSolve) add_executable(posInterp posInterp.cpp) target_link_libraries(posInterp gpstk) -install (TARGETS posInterp DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS posInterp DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(posInterpTest posInterp) diff --git a/ext/apps/positioning/PRSolve.cpp b/ext/apps/positioning/PRSolve.cpp index e35a21b33..dada36959 100644 --- a/ext/apps/positioning/PRSolve.cpp +++ b/ext/apps/positioning/PRSolve.cpp @@ -103,7 +103,7 @@ using namespace gpstk; using namespace gpstk::StringUtils; //------------------------------------------------------------------------------------ -string Version(string("5.1 5/11/15")); +string Version(string("5.2 10/13/15")); // forward declarations class SolutionObject; @@ -128,9 +128,9 @@ class Configuration : public Singleton { // Open the output file, and parse the strings used on the command line // return -4 if log file could not be opened - int ExtraProcessing(void) throw(); + //int ExtraProcessing(void) throw(); //TD on clau, this leads to the SPS algorithm failing to converge on some problems. - //int ExtraProcessing(string& errors, string& extras) throw(); + int ExtraProcessing(string& errors, string& extras) throw(); // update weather in the trop model using the Met store void setWeather(const CommonTime& ttag) throw(Exception); @@ -172,6 +172,7 @@ class Configuration : public Singleton { bool searchUser; // use SearchUser() for BCE, else SearchNear() vector exclSat;// exclude satellites + bool PisY; // Interpret RINEX 2 P code as if the receiver was keyed bool SPSout,ORDout; // output autonomous solutions? ORDs? bool outver2; // output RINEX version 2 (OutputObsFile) string LogFile; // output log file (required) @@ -735,7 +736,7 @@ try { } catch(Exception& e) { os << "Exception: " << e.what() << endl; isValid = false; continue; } - catch(exception& e) { + catch(std::exception& e) { os << "exception: " << e.what(); isValid = false; continue; } startNameMap.insert(multimap::value_type( header.time,C.InputSP3Files[nfile])); @@ -1220,6 +1221,12 @@ try { Rinex3ObsHeader Rhead, Rheadout; Rinex3ObsData Rdata; string filename(C.InputObsFiles[nfile]); + + if (C.PisY) + { + LOG(DEBUG) << "Converting P/W code data to Y code"; + Rhead.PisY = C.PisY; + } // iret is set to 0 ok, or could not: 1 open file, 2 read header, 3 read data iret = 0; @@ -1270,7 +1277,7 @@ try { } break; } - + // do on first epoch only if(firstepoch) { // if writing to output RINEX, open and write header --------- @@ -1346,7 +1353,7 @@ try { iret = 3; break; } - catch(exception& e) { + catch(std::exception& e) { Exception ge(string("Std excep: ") + e.what()); GPSTK_THROW(ge); } @@ -1582,6 +1589,7 @@ void Configuration::SetDefaults(void) throw() beginTime = gpsBeginTime = GPSWeekSecond(0,0.,TimeSystem::Any); endTime = CommonTime::END_OF_TIME; + PisY = false; SOLhelp = false; TropType = string("NewB"); @@ -1725,7 +1733,9 @@ int Configuration::ProcessUserInput(int argc, char **argv) throw() } // extra parsing (perhaps add to cmdlineErrors, cmdlineExtras) - iret = ExtraProcessing(); //TD clau failure: cmdlineErrors, cmdlineExtras); + //TD clau failure: cmdlineErrors, cmdlineExtras); + //iret = ExtraProcessing(); + iret = ExtraProcessing(cmdlineErrors, cmdlineExtras); if(iret == -4) return iret; // log file could not be opened // output warning / error messages @@ -1859,7 +1869,8 @@ string Configuration::BuildCommandLine(void) throw() "Exclude this satellite [eg. G24 | R | R23,G31]"); opts.Add(0, "BCEpast", "", false, false, &searchUser, "", "Use 'User' find-ephemeris-algorithm (else nearest) (--nav only)"); - + opts.Add(0, "PisY", "", false, false, &PisY, "", + "P code data is actually Y code data"); opts.Add(0, "sol", "S:F:C", true, false, &inSolDesc, "# Solution Descriptors define data used in solution algorithm", "Specify data System:Freqs:Codes to be used to generate solution(s)"); @@ -1916,8 +1927,7 @@ string Configuration::BuildCommandLine(void) throw() } // end Configuration::BuildCommandLine() //------------------------------------------------------------------------------------ -//TD clau failure: ExtraProcessing(string& errors, string& extras) throw() -int Configuration::ExtraProcessing(void) throw() +int Configuration::ExtraProcessing(string& errors, string& extras) throw() { int i,n; vector fld; @@ -1946,7 +1956,8 @@ int Configuration::ExtraProcessing(void) throw() << refPosStr << endl; else { try { - knownPos.setECEF(asDouble(fld[0]),asDouble(fld[1]),asDouble(fld[2])); + double X(asDouble(fld[0])),Y(asDouble(fld[1])),Z(asDouble(fld[2])); + knownPos.setECEF(X,Y,Z); ossx << " Reference position --ref is " << knownPos.printf("XYZ(m): %.3x %.3y %.3z = LLH: %.9A %.9L %.3h\n"); } @@ -2063,9 +2074,11 @@ int Configuration::ExtraProcessing(void) throw() // add new errors to the list msg = oss.str(); - if(!msg.empty()) cmdlineErrors += msg; + //if(!msg.empty()) cmdlineErrors += msg; + if(!msg.empty()) errors += msg; msg = ossx.str(); - if(!msg.empty()) cmdlineExtras += msg; + //if(!msg.empty()) cmdlineExtras += msg; + if(!msg.empty()) extras += msg; return 0; diff --git a/ext/apps/positioning/posInterp.cpp b/ext/apps/positioning/posInterp.cpp index d83b7e7b2..6b142d50b 100644 --- a/ext/apps/positioning/posInterp.cpp +++ b/ext/apps/positioning/posInterp.cpp @@ -264,7 +264,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -330,7 +330,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -439,7 +439,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -477,7 +477,7 @@ try { psdata.auxHeader.valid |= RinexObsHeader::commentValid; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -657,7 +657,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -728,7 +728,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1067,7 +1067,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1133,7 +1133,7 @@ try { else Args.push_back(arg); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/apps/positioning/poscvt.cpp b/ext/apps/positioning/poscvt.cpp index 5fc2980a9..a84ee8347 100644 --- a/ext/apps/positioning/poscvt.cpp +++ b/ext/apps/positioning/poscvt.cpp @@ -198,7 +198,7 @@ int main(int argc, char* argv[]) { cout << e << endl; } - catch(exception& e) + catch(std::exception& e) { cout << e.what() << endl; } diff --git a/ext/apps/receiver/CMakeLists.txt b/ext/apps/receiver/CMakeLists.txt index cf4e80898..55a985678 100755 --- a/ext/apps/receiver/CMakeLists.txt +++ b/ext/apps/receiver/CMakeLists.txt @@ -2,5 +2,6 @@ add_executable(rtAshtech AshtechMessage.cpp rtAshtech.cpp ScreenControl.cpp) target_link_libraries(rtAshtech gpstk) -install (TARGETS rtAshtech DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rtAshtech DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rtAshtechTest rtAshtech) diff --git a/ext/apps/rfw/CMakeLists.txt b/ext/apps/rfw/CMakeLists.txt index ffc13dd45..a620db2ed 100755 --- a/ext/apps/rfw/CMakeLists.txt +++ b/ext/apps/rfw/CMakeLists.txt @@ -2,7 +2,8 @@ add_executable(rfw rfw.cpp FDStreamBuff.cpp TCPStreamBuff.cpp) target_link_libraries(rfw gpstk) -install (TARGETS rfw DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS rfw DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(rfwTest rfw) if (CMAKE_SYSTEM_NAME MATCHES "SunOS") target_link_libraries(rfw socket nsl) diff --git a/ext/apps/swrx/CMakeLists.txt b/ext/apps/swrx/CMakeLists.txt index 5adabcd34..1431ca354 100644 --- a/ext/apps/swrx/CMakeLists.txt +++ b/ext/apps/swrx/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries(iqdump simlib) add_executable(codeDump codeDump.cpp) target_link_libraries(codeDump simlib) -install (TARGETS codeDump DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS codeDump DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) add_executable(position position.cpp) target_link_libraries(position simlib) diff --git a/ext/apps/swrx/SimpleCorrelator.hpp b/ext/apps/swrx/SimpleCorrelator.hpp index c6037047c..eebb323f6 100644 --- a/ext/apps/swrx/SimpleCorrelator.hpp +++ b/ext/apps/swrx/SimpleCorrelator.hpp @@ -52,7 +52,7 @@ class SimpleCorrelator typedef std::complex Ctype; /// param d this is the number of samples to delay the code by - SimpleCorrelator(unsigned d=0) : delay(d+1), sum(0) + SimpleCorrelator(unsigned d=0) : delay(d+1), sum(0,0) {} inline void process(std::complex in, Ctype code) throw() diff --git a/ext/apps/time/CMakeLists.txt b/ext/apps/time/CMakeLists.txt index f426c09db..531dddab6 100755 --- a/ext/apps/time/CMakeLists.txt +++ b/ext/apps/time/CMakeLists.txt @@ -2,9 +2,11 @@ add_executable(timeconvert timeconvert.cpp) target_link_libraries(timeconvert gpstk) -install (TARGETS timeconvert DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS timeconvert DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(timeconvertTest timeconvert) add_executable(calgps calgps.cpp) target_link_libraries(calgps gpstk) -install (TARGETS calgps DESTINATION "${CMAKE_INSTALL_BINDIR}") +install (TARGETS calgps DESTINATION ${CMAKE_INSTALL_BINDIR} EXPORT ${EXPORT_TARGETS_FILENAME}) +#add_test(calgpsTest calgps) diff --git a/ext/lib/AstroEph/AstronomicalFunctions.cpp b/ext/lib/AstroEph/AstronomicalFunctions.cpp index 7f228356c..4e0aa4322 100644 --- a/ext/lib/AstroEph/AstronomicalFunctions.cpp +++ b/ext/lib/AstroEph/AstronomicalFunctions.cpp @@ -89,7 +89,7 @@ namespace gpstk double h(yds.sod/3600.0); // Compute Julian Day, including decimals - double jd(JulianDate(t).jd); + double jd(static_cast(JulianDate(t).jd)); // Temporal value, in centuries double tt( (jd - 2451545.0)/36525.0 ); diff --git a/ext/lib/AstroEph/MoonPosition.cpp b/ext/lib/AstroEph/MoonPosition.cpp index 1c768a4c2..546fd28dc 100644 --- a/ext/lib/AstroEph/MoonPosition.cpp +++ b/ext/lib/AstroEph/MoonPosition.cpp @@ -462,7 +462,7 @@ namespace gpstk // Centuries since J1900 - double tt((MJD(t).mjd-15019.5)/36525.0); + double tt(static_cast((MJD(t).mjd-15019.5)/36525.0)); // Fundamental arguments (radians) and derivatives (radians per diff --git a/ext/lib/AstroEph/PlanetEphemeris.cpp b/ext/lib/AstroEph/PlanetEphemeris.cpp index e9971202e..035f91aa5 100644 --- a/ext/lib/AstroEph/PlanetEphemeris.cpp +++ b/ext/lib/AstroEph/PlanetEphemeris.cpp @@ -219,7 +219,7 @@ namespace gpstk store.clear(); } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readASCIIheader()' @@ -260,7 +260,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readASCIIdata()' @@ -351,7 +351,7 @@ namespace gpstk return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readASCIIdata()' @@ -447,7 +447,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::writeASCIIheader()' @@ -498,7 +498,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::writeASCIIdata(ostream& os) ' @@ -627,7 +627,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::writeBinaryFile()' @@ -648,7 +648,7 @@ namespace gpstk return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readBinaryFile(string filename)' @@ -675,7 +675,7 @@ namespace gpstk return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::initializeWithBinaryFile(string filename) ' @@ -773,7 +773,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::computeState()' @@ -792,7 +792,7 @@ namespace gpstk } } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::writeBinary()' @@ -811,7 +811,7 @@ namespace gpstk } } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readBinary()' @@ -947,7 +947,7 @@ namespace gpstk } } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readBinaryHeader(std::string filename) ' @@ -1004,7 +1004,7 @@ namespace gpstk return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readBinaryData(bool save)' @@ -1037,7 +1037,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::readBinaryRecord()' @@ -1079,7 +1079,7 @@ namespace gpstk return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::seekToJD()' @@ -1150,7 +1150,7 @@ namespace gpstk } } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } // End of method 'PlanetEphemeris::computeState()' diff --git a/ext/lib/FileHandling/Ionex/IonexData.cpp b/ext/lib/FileHandling/Ionex/IonexData.cpp index af2f64893..53c782804 100644 --- a/ext/lib/FileHandling/Ionex/IonexData.cpp +++ b/ext/lib/FileHandling/Ionex/IonexData.cpp @@ -214,7 +214,7 @@ namespace gpstk * stream to its pre-read position. */ void IonexData::reallyGetRecord(FFStream& ffs) - throw( exception, FFStreamError, gpstk::StringUtils::StringException ) + throw( std::exception, FFStreamError, gpstk::StringUtils::StringException ) { IonexStream& strm = dynamic_cast(ffs); diff --git a/ext/lib/FileHandling/Ionex/IonexHeader.cpp b/ext/lib/FileHandling/Ionex/IonexHeader.cpp index 896ccd681..e88bf07e2 100644 --- a/ext/lib/FileHandling/Ionex/IonexHeader.cpp +++ b/ext/lib/FileHandling/Ionex/IonexHeader.cpp @@ -394,7 +394,7 @@ namespace gpstk // This function parses the entire header from the given stream void IonexHeader::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { IonexStream& strm = dynamic_cast (ffs); @@ -517,7 +517,7 @@ namespace gpstk grdfac[2] = lon[0]/lon[2]; grdfac[3] = lon[1]/lon[2]; } - catch(exception& e) + catch(std::exception& e) { cerr << "Problems computing grdfac: " << e.what() << endl; throw; @@ -547,7 +547,7 @@ namespace gpstk void IonexHeader::reallyPutRecord(FFStream& ffs) const - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { IonexStream& strm = dynamic_cast(ffs); diff --git a/ext/lib/GNSSCore/OceanLoading.cpp b/ext/lib/GNSSCore/OceanLoading.cpp index e18bb5347..6cd2110a1 100644 --- a/ext/lib/GNSSCore/OceanLoading.cpp +++ b/ext/lib/GNSSCore/OceanLoading.cpp @@ -181,7 +181,7 @@ namespace gpstk Vector arguments(NUM_HARMONICS,0.0); // Get day of year - short year(static_cast(time).year); + int year(static_cast(time).year); // Fractional part of day, in seconds double fday(static_cast(time).sod); diff --git a/ext/lib/GNSSCore/PoleTides.cpp b/ext/lib/GNSSCore/PoleTides.cpp index bb8b4bfa7..45971bc0a 100644 --- a/ext/lib/GNSSCore/PoleTides.cpp +++ b/ext/lib/GNSSCore/PoleTides.cpp @@ -86,7 +86,7 @@ namespace gpstk // Compute appropriate running averages // Get time difference between current epoch and // J2000.0, in years - double timedif((MJD(t).mjd - MJD(j2000).mjd)/365.25); + double timedif(static_cast((MJD(t).mjd - MJD(j2000).mjd)/365.25)); double xpbar(0.054 + timedif*0.00083); double ypbar(0.357 + timedif*0.00395); diff --git a/ext/lib/GNSSEph/GPSOrbElemStore.cpp b/ext/lib/GNSSEph/GPSOrbElemStore.cpp index 2ec9c9751..266419e43 100755 --- a/ext/lib/GNSSEph/GPSOrbElemStore.cpp +++ b/ext/lib/GNSSEph/GPSOrbElemStore.cpp @@ -46,6 +46,7 @@ #include "StringUtils.hpp" #include "GPSOrbElemStore.hpp" #include "MathBase.hpp" +#include "OrbElem.hpp" #include "CivilTime.hpp" #include "TimeString.hpp" @@ -57,63 +58,6 @@ using gpstk::StringUtils::asString; namespace gpstk { -//-------------------------------------------------------------------------- - - Xvt GPSOrbElemStore::getXvt(const SatID& sat, const CommonTime& t) const - throw( InvalidRequest ) - { - try - { - // test for GPS satellite system in sat? - const OrbElem* eph = findOrbElem(sat,t); - - // If the orbital elements are unhealthy, refuse to - // calculate an SV position and throw. - if (!eph->healthy) - { - InvalidRequest exc( std::string("SV is transmitting unhealhty navigation ") - + std::string("message at time of interest.") ); - GPSTK_THROW( exc ); - } - Xvt sv = eph->svXvt(t); - return sv; - } - catch(InvalidRequest& ir) - { - GPSTK_RETHROW(ir); - } - } - -//------------------------------------------------------------------------------ - - void validSatSystem(const SatID& sat) - throw( InvalidRequest ) - { - InvalidRequest ire( std::string("Try to get NON-GPS sat position ") - + std::string("from GPSOrbElemStore, and it's forbidden!") ); - if(sat.system!=SatID::systemGPS) GPSTK_THROW(ire); - } - -//-------------------------------------------------------------------------- - - bool GPSOrbElemStore::isHealthy(const SatID& sat, const CommonTime& t) const - throw( InvalidRequest ) - { - try - { - validSatSystem(sat); - - // test for GPS satellite system in sat? - const OrbElem* eph = findOrbElem(sat, t); - - return eph->isHealthy(); - } - catch(InvalidRequest& ir) - { - GPSTK_RETHROW(ir); - } - } // end of GPSOrbElemStore::getHealth() - //-------------------------------------------------------------------------- void GPSOrbElemStore::dump(std::ostream& s, short detail) const @@ -143,7 +87,10 @@ namespace gpstk for (ei = em.begin(); ei != em.end(); ei++) { - const OrbElem* oe = ei->second; + // Since this is GPSOrbElemStore, then the type in the + // store must AT LEAST be OrbElem. + const OrbElemBase* oeb = ei->second; + const OrbElem* oe = dynamic_cast(oeb); s << "PRN " << setw(2) << it->first << " TOE " << printTime(oe->ctToe,fmt) << " TOC " << printTime(oe->ctToc,fmt) @@ -174,16 +121,21 @@ namespace gpstk << " has " << em.size() << " entries." << std::endl; OrbElemMap::const_iterator ei; - s << " PRN MM/DD/YY Key Begin Toe Toc End" << endl; + s << " PRN MM/DD/YY Key Begin Toe Toc End Healthy" << endl; for (ei = em.begin(); ei != em.end(); ei++) { - const OrbElem* oe = ei->second; + // Since this is GPSOrbElemStore, then the type in the + // store must AT LEAST be OrbElem. + const OrbElemBase* oeb = ei->second; + const OrbElem* oe = dynamic_cast(oeb); s << it->first << " " << printTime(ei->first,tf1) << " " << printTime(oe->beginValid,tf2) << " " << printTime(oe->ctToe,tf2) << " " << printTime(oe->ctToc,tf2) << " " << printTime(oe->endValid,tf2); + if (oe->healthy) s << " " << " Yes"; + else s << " " << " No"; s << std::endl; } //end inner for-loop */ @@ -201,339 +153,14 @@ namespace gpstk for (ei = em.begin(); ei != em.end(); ei++) { - const OrbElem* oe = ei->second; + const OrbElemBase* oe = ei->second; oe->dump(s); } } } } // end GPSOrbElemStore::dump -//------------------------------------------------------------------------------------ - - - -//------------------------------------------------------------------------------------ -// Keeps only one OrbElem for a given SVN and Toe. -// It should keep the one with the earliest transmit time. -//------------------------------------------------------------------------------------ - bool GPSOrbElemStore::addOrbElem(const OrbElem& eph) - throw(InvalidParameter,Exception) - { - try - { - - SatID sid = eph.satID; - OrbElemMap& oem = ube[sid]; - string ts = "%02m/%02d/%02y %02H:%02M:%02S"; - - // if map is empty, load object and return - if (oem.size()==0) - { - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - // Search for beginValid in current keys. - // If found candidate, should be same data - // as already in table. Test this by comparing - // Toe values. - OrbElemMap::iterator it = oem.find(eph.beginValid); - if(it!=oem.end()) - { - const OrbElem* oe = it->second; - // Found duplicate already in table - if(oe->ctToe==eph.ctToe) - { - return (false); - } - // Found matching beginValid but different Toe - This shouldn't happen - else - { - string str = "Unexpectedly found matching beginValid times"; - stringstream os; - os << eph.satID.id; - str += " but different Toe. PRN= " + os.str(); - str += ", beginValid= " + printTime(eph.beginValid,ts); - str += ", Toe(map)= " + printTime(eph.ctToe,ts); - str += ", Toe(candidate)= "+ printTime(oe->ctToe," %6.0g"); - str += ". "; - InvalidParameter exc( str ); - GPSTK_THROW(exc); - } - } - // Did not already find match to - // beginValid in map - // N.B:: lower_bound will reutrn element beyond key since there is no match - it = oem.lower_bound(eph.beginValid); - // Case where candidate is before beginning of map - if(it==oem.begin()) - { - const OrbElem* oe = it->second; - if(oe->ctToe==eph.ctToe) - { - oem.erase(it); - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - // Case where candidate is after end of current map - if(it==oem.end()) - { - // Get last item in map and check Toe - OrbElemMap::reverse_iterator rit = oem.rbegin(); - const OrbElem* oe = rit->second; - if(oe->ctToe!=eph.ctToe) - { - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - return (false); - } - // case where candidate is "In the middle" - // Check if iterator points to late transmission of - // same OrbElem as candidate - const OrbElem* oe = it->second; - if(oe->ctToe==eph.ctToe) - { - oem.erase(it); - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - // Two cases: - // (a.) Candidate is late transmit copy of - // previous OrbElem in table - discard (do nothing) - // (b.) Candidate OrbElem is not in table - - // Already checked for it==oem.beginValid() earlier - it--; - const OrbElem* oe2 = it->second; - if(oe2->ctToe!=eph.ctToe) - { - oem[eph.beginValid] = eph.clone(); - updateInitialFinal(eph); - return (true); - } - return (false); - - } - catch(Exception& e) - { - GPSTK_RETHROW(e) - } - } - -//----------------------------------------------------------------------------- - - void GPSOrbElemStore::edit(const CommonTime& tmin, const CommonTime& tmax) - throw() - { - for(UBEMap::iterator i = ube.begin(); i != ube.end(); i++) - { - OrbElemMap& eMap = i->second; - - OrbElemMap::iterator lower = eMap.lower_bound(tmin); - if (lower != eMap.begin()) - { - for (OrbElemMap::iterator emi = eMap.begin(); emi != lower; emi++) - delete emi->second; - eMap.erase(eMap.begin(), lower); - } - - OrbElemMap::iterator upper = eMap.upper_bound(tmax); - if (upper != eMap.end()) - { - for (OrbElemMap::iterator emi = upper; emi != eMap.end(); emi++) - delete emi->second; - eMap.erase(upper, eMap.end()); - } - } - - initialTime = tmin; - finalTime = tmax; - } - -//----------------------------------------------------------------------------- - - unsigned GPSOrbElemStore::size() const - throw() - { - unsigned counter = 0; - for(UBEMap::const_iterator i = ube.begin(); i != ube.end(); i++) - counter += i->second.size(); - return counter; - } - -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Goal is to find the set of orbital elements that would have been -// used by a receiver in real-time. That is to say, the most recently -// broadcast elements (assuming the receiver has visibility to the SV -// in question). -//----------------------------------------------------------------------------- - - const OrbElem* - GPSOrbElemStore::findOrbElem(const SatID& sat, const CommonTime& t) const - throw( InvalidRequest ) - { - // Check to see that there exists a map of orbital elements - // relevant to this SV. - UBEMap::const_iterator prn_i = ube.find(sat); - if (prn_i == ube.end()) - { - InvalidRequest e("No orbital elements for satellite " + asString(sat)); - GPSTK_THROW(e); - } - - // Define reference to the relevant map of orbital elements - const OrbElemMap& em = prn_i->second; - - // The map is ordered by beginning times of validity, which - // is another way of saying "earliest transmit time". A call - // to em.lower_bound( t ) will return the element of the map - // with a key "one beyond the key" assuming the t is NOT a direct - // match for any key. - - // First, check for the "direct match" case - OrbElemMap::const_iterator it = em.find(t); - // If that fails, then use lower_bound( ) - if (it == em.end( )) - { - it = em.lower_bound(t); - - // Tricky case here. If the key is beyond the last key in the table, - // lower_bound( ) will return em.end( ). However, this doesn't entirely - // settle the matter. It is theoretically possible that the final - // item in the table may have an effectivity that "stretches" far enough - // to cover time t. Therefore, if it==em.end( ) we need to check - // the period of validity of the final element in the table against - // time t. - // - if (it==em.end()) - { - OrbElemMap::const_reverse_iterator rit = em.rbegin(); - if (rit->second->isValid(t)) return(rit->second); // Last element in map works - - // We reached the end of the map, checked the end of the map, - // and we still have nothing. - string mess = "All orbital elements found for satellite " + asString(sat) + " are too early for time " - + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); - InvalidRequest e(mess); - GPSTK_THROW(e); - } - } - - // If the algorithm found a direct match, then we should - // probably use the PRIOR set since it takes ~30 seconds - // from beginning of transmission to complete reception. - // If lower_bound( ) was called, it points to the element - // after the time of the key. - // So either way, it points ONE BEYOND the element we want. - // - // The exception is if it is pointing to em.begin( ). If that is the case, - // then all of the elements in the map are too late. - if (it==em.begin()) - { - string mess = "All orbital elements found for satellite " + asString(sat) + " are too late for time " - + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); - InvalidRequest e(mess); - GPSTK_THROW(e); - } - - // The iterator should be a valid iterator and set one beyond - // the item of interest. However, there may be gaps in the - // middle of the map and cases where periods of effectivity do - // not overlap. That's OK, the key represents the EARLIEST - // time the elements should be used. Therefore, we can - // decrement the counter and test to see if the element is - // valid. - it--; - if (!(it->second->isValid(t))) - { - // If we reach this throw, the cause is a "hole" in the middle of a map. - string mess = "No orbital elements found for satellite " + asString(sat) + " at " - + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); - InvalidRequest e(mess); - GPSTK_THROW(e); - } - return(it->second); - } - - - - -//----------------------------------------------------------------------------- - - const OrbElem* - GPSOrbElemStore::findNearOrbElem(const SatID& sat, const CommonTime& t) const - throw(InvalidRequest) - { - // Check for any OrbElem for this SV - UBEMap::const_iterator prn_i = ube.find(sat); - if (prn_i == ube.end()) - { - InvalidRequest e("No OrbElem for satellite " + asString(sat)); - GPSTK_THROW(e); - } - - // FIRST, try to find the elements that were - // actually being broadcast at the time of - // interest. That will ALWAYS be the most - // correct response. IF YOU REALLY THINK - // OTHERWISE CALL ME AND LET'S TALK ABOUT - // IT - Brent Renfro - try - { - const OrbElem* oep = findOrbElem(sat, t); - return(oep); - } - // No OrbElem in store for requested sat time - catch(InvalidRequest) - { - // Create references to map for this satellite - const OrbElemMap& em = prn_i->second; - /* - Three Cases: - 1. t is within a gap within the store - 2. t is before all OrbElem in the store - 3. t is after all OrbElem in the store - */ - - // Attempt to find next in store after t - OrbElemMap::const_iterator itNext = em.lower_bound(t); - // Test for case 2 - if(itNext==em.begin()) - { - return(itNext->second); - } - // Test for case 3 - if(itNext==em.end()) - { - OrbElemMap::const_reverse_iterator rit = em.rbegin(); - return(rit->second); - } - // Handle case 1 - // Know that itNext is not the beginning, so safe to decrement - CommonTime nextBeginValid = itNext->first; - OrbElemMap::const_iterator itPrior = itNext; - itPrior--; - CommonTime lastEndValid = itPrior->second->endValid; - double diffToNext = nextBeginValid-t; - double diffFromLast = t - lastEndValid; - if(diffToNext>diffFromLast) - { - return(itPrior->second); - } - return(itNext->second); - } - } - +//------------------------------------------------------------------------------------ // See notes in the .hpp. This function is designed to be called // AFTER all elements are loaded. It can then make adjustments to // time relationships based on inter-comparisons between sets of @@ -547,7 +174,7 @@ namespace gpstk { OrbElemMap& em = it->second; OrbElemMap::iterator ei; - OrbElemMap::iterator eiPrev; + OrbElemMap::iterator eiPrev; bool begin = true; double previousOffset = 0.0; long previousToe = 0.0; @@ -565,11 +192,14 @@ namespace gpstk // uploads. Uploads are identifed by // Toe values that are offset from // an even hour. - OrbElem* oePrev = 0; + OrbElemBase* oePrev = 0; for (ei = em.begin(); ei != em.end(); ei++) { currentIsOffset = false; // start with this assumption - OrbElem* oe = ei->second; + // Since this is GPSOrbElemStore, then the type in the + // store must AT LEAST be OrbElem. + OrbElemBase* oeb = ei->second; + OrbElem* oe = dynamic_cast(oeb); long Toe = (long) (static_cast (oe->ctToe)).sow; double currentOffset = Toe % 3600; @@ -667,7 +297,7 @@ namespace gpstk bool done = false; while (!done) { - OrbElem* oeRev = ri->second; + OrbElemBase* oeRev = ri->second; //cout << "Testing Toe of " << printTime(oeRev->ctToe,"%02H:%02M:%02S"); //cout << " with endValid of " << printTime(oeRev->endValid,"%02H:%02M:%02S") << endl; @@ -732,11 +362,11 @@ namespace gpstk ei = em.lower_bound(loopStart); while (ei!=em.end()) { - OrbElem* oe = ei->second; + OrbElemBase* oe = ei->second; if (ei->first!=oe->beginValid) { //cout << "Removing an element....."; - OrbElem* oeAdj= oe->clone(); // Adjustment was done in + OrbElemBase* oeAdj= oe->clone(); // Adjustment was done in // first loop above. delete ei->second; // oe becomes invalid. em.erase(ei); // Remove the map entry. @@ -763,43 +393,5 @@ namespace gpstk } // end outer for-loop //cout << "Exiting GPSOrbElem.rationalize()" << endl; } - - -//----------------------------------------------------------------------------- - - int GPSOrbElemStore::addToList(std::list& v) const - throw() - { - int n = 0; - UBEMap::const_iterator prn_i; - for (prn_i = ube.begin(); prn_i != ube.end(); prn_i++) - { - const OrbElemMap& em = prn_i->second; - OrbElemMap::const_iterator ei; - for (ei = em.begin(); ei != em.end(); ei++) - { - v.push_back(ei->second->clone()); - n++; - } - } - return n; - } - -//----------------------------------------------------------------------------- - - const GPSOrbElemStore::OrbElemMap& - GPSOrbElemStore::getOrbElemMap( const SatID& sat ) const - throw( InvalidRequest ) - { - validSatSystem(sat); - - UBEMap::const_iterator prn_i = ube.find(sat); - if (prn_i == ube.end()) - { - InvalidRequest e("No OrbElem for satellite " + asString(sat)); - GPSTK_THROW(e); - } - return(prn_i->second); - } } // namespace diff --git a/ext/lib/GNSSEph/GPSOrbElemStore.hpp b/ext/lib/GNSSEph/GPSOrbElemStore.hpp old mode 100644 new mode 100755 index 056d8e7f8..5b8f7d92e --- a/ext/lib/GNSSEph/GPSOrbElemStore.hpp +++ b/ext/lib/GNSSEph/GPSOrbElemStore.hpp @@ -48,13 +48,8 @@ #include #include -#include "OrbElem.hpp" +#include "OrbElemBase.hpp" #include "OrbElemStore.hpp" -#include "Exception.hpp" -#include "SatID.hpp" -#include "CommonTime.hpp" -#include "XvtStore.hpp" -#include "TimeSystem.hpp" namespace gpstk { @@ -70,206 +65,23 @@ namespace gpstk GPSOrbElemStore() throw() - : initialTime(CommonTime::END_OF_TIME), - finalTime(CommonTime::BEGINNING_OF_TIME), - strictMethod(true) { - initialTime.setTimeSystem(TimeSystem::GPS); - finalTime.setTimeSystem(TimeSystem::GPS); + initialTime.setTimeSystem(TimeSystem::Any); + finalTime.setTimeSystem(TimeSystem::Any); + addSatSys(SatID::systemGPS); + setTimeSystem(TimeSystem::GPS); } - virtual ~GPSOrbElemStore() { clear();} - /// Returns the position, velocity, and clock offset of the indicated - /// satellite in ECEF coordinates (meters) at the indicated time. - /// @param[in] sat the SV's SatID - /// @param[in] t the time to look up - /// @return the Xvt of the SV at time - /// @throw InvalidRequest If the request can not be completed for any - /// reason, this is thrown. The text may have additional - /// information as to why the request failed. Possible reasons - /// include - /// 1. No orbital elements stored for the SV - /// 2. No orbital elements with time of validity covering time t - /// 3. Orbital elements appropriate for time t are unhealhty - /// The purpose of getX is to be as SAFE as possible. - /// If you MUST obtain SV PVT in the failure conditions noted above, - /// please consider calling findOrbElem( ) or findNearOrbElem( ) - /// directly to obtain elements, then use OrbElem.getXvt( ) - /// to obtain positions. - virtual Xvt getXvt( const SatID& sat, const CommonTime& t ) const - throw( InvalidRequest ); - - /// A debugging function that outputs in human readable form, - /// all data stored in this object. - /// @param[in] s the stream to receive the output; defaults to cout - /// @param[in] detail the level of detail to provide - virtual void dump( std::ostream& s = std::cout, short detail = 0 ) const - throw(); - - /// Edit the dataset, removing data outside the indicated time interval - /// @param tmin defines the beginning of the time interval, included - /// @param tmax defines the end of the time interval. not included - /// [tmin, tmax) - virtual void edit( const CommonTime& tmin, - const CommonTime& tmax = CommonTime::END_OF_TIME ) - throw(); - - - /// Return time system (NB assumed always to be GPS) - virtual TimeSystem getTimeSystem(void) const throw() - { return TimeSystem::GPS; } - - /// Determine the earliest time for which this object can successfully - /// determine the Xvt for any satellite. - /// @return The initial time - /// @throw InvalidRequest This is thrown if the object has no data. - virtual CommonTime getInitialTime() const - throw() - { return initialTime; } - - - /// Determine the latest time for which this object can successfully - /// determine the Xvt for any satellite. - /// @return The final time - /// @throw InvalidRequest This is thrown if the object has no data. - virtual CommonTime getFinalTime() const - throw() - { return finalTime; } - - virtual bool velocityIsPresent() - const throw() - { return true; } - - /// Return true if velocity data is present in the store - virtual bool hasVelocity() const throw() - { return true; } - - /// Return true if the given IndexType is present in the store - virtual bool isPresent(const SatID& sat) const throw() - { - if(ube.find(sat) != ube.end()) return true; - return false; - } - - //--------------------------------------------------------------- - // Below are interfaces that are unique to this class (i.e. not - // in the parent class) - //--------------------------------------------------------------- - - /// Returns the health of an SV for a particular time. - /// @param sat the satellite's SatID - /// @param t the time to look up - /// @return the SV health bits - /// @throw InvalidRequest no matching OrbElem found in the store - bool isHealthy( const SatID& sat, const CommonTime& t ) const - throw( InvalidRequest ); - - - /// Add an OrbElem object to this collection. - /// @param eph the OrbElem to add - /// @return true if OrbElem was added, false otherwise - bool addOrbElem( const OrbElem& eph ) - throw(InvalidParameter,Exception); - - /// Remove all data from this collection. - void clear() - throw() - { - for( UBEMap::iterator ui = ube.begin(); ui != ube.end(); ui++) - { - OrbElemMap& oem = ui->second; - for (OrbElemMap::iterator oi = oem.begin(); oi != oem.end(); oi++) - { - delete oi->second; - } - } - ube.clear(); - initialTime = gpstk::CommonTime::END_OF_TIME; - finalTime = gpstk::CommonTime::BEGINNING_OF_TIME; - initialTime.setTimeSystem(TimeSystem::GPS); - finalTime.setTimeSystem(TimeSystem::GPS); - } - - /// Get the number of OrbElem objects in this collection. - /// @return the number of OrbElem records in the map - unsigned size() const + void dump(std::ostream& s=std::cout, short detail=0) const throw(); /* - * Explanation of find( ) function for GPSOrbElemStore - * - * The findOrbElem( ) funtion - * does the best possible job of emulating the choice - * that would be made by a real-time user following the - * selection crieteria and warnings defined in the - * IS-GPS-200. - * - * It is strongly suggested that the user load ALL - * available set of orbital elements into the store, - * regardless of health status. It is furthermore - * suggested the user call rationalize( ) to adjust - * the begin/end times of validity after loading - * all the elements and before using the store. + * Following method is unique to GPSOrbElemStore and does not + * exist in OrbElemStore. * - * There exists a second find fuction, findNearOrbElem( ). - * This is provided for compatibility with past uses - * of the GPSEphemerisStore class. findNearOrbElem( ) MAY - * return elements that are outside the range of - * validity and therefore need to be used with caution. - * Therefore,if you wish - * to use findNearOrbElem( ), you should do so directly, - * carefully examine the resulting set of orbital elements - * and make an informed decision before using the - * OrbElem.get????( ) functions. - */ - /// @param sat SatID of satellite of interest - /// @param t time with which to search for OrbElem - /// @return a reference to the desired OrbElem - /// @throw InvalidRequest object thrown when no OrbElem is found - const OrbElem* findOrbElem( const SatID& sat, const CommonTime& t ) - const throw( InvalidRequest ); - - - /// Find an OrbElem for the indicated satellite at time t. The OrbElem - /// chosen is the one with HOW time closest to the time t, (i.e. with - /// smallest fabs(t-HOW), but still within the fit interval. - /// @param sat the SV of interest - /// @param t the time of interest - /// @return a reference to desired OrbElem - /// @throw InvalidRequest object thrown when no OrbElem is found - const OrbElem* findNearOrbElem( const SatID& sat, const CommonTime& t ) - const throw( InvalidRequest ); - - /// Add all ephemerides to an existing list. - /// @return the number of ephemerides added. - int addToList( std::list& v ) const - throw(); - - /// use findNearOrbElem() in the getSat...() routines - void SearchNear(void) - throw() - { strictMethod = false; } - - /// use findUserOrbElem() in the getSat...() routines (the default) - void SearchUser(void) - throw() - { strictMethod = true; } - - /// This is intended to store sets of unique orbital elements for a single SV. - /// The key is the beginning of the period of validity for each set of elements. - typedef std::map OrbElemMap; - - /// Returns a map of the ephemerides available for the specified - /// satellite. Note that the return is specifically chosen as a - /// const reference. The intent is to provide "read only" access - /// for analysis. If the map needs to be modified, see other methods. - const OrbElemMap& getOrbElemMap( const SatID& sat ) const - throw( InvalidRequest ); - - /* * Notes regarding the rationalize( ) function. * The timing relationships defined in IS-GPS-200 20.3.4.5 mean * (1.) The end of validity of a given set of orbital elements @@ -295,35 +107,6 @@ namespace gpstk */ void rationalize( ); - protected: - - /// This is intended to hold all unique EngEphemerides for each SV - /// The key is the prn of the SV. - typedef std::map UBEMap; - - /// The map where all EngEphemerides are stored. - UBEMap ube; - - CommonTime initialTime; //< Time of the first OrbElem - CommonTime finalTime; //< Time of the last OrbElem - - /// flag indicating search method (find...Eph) to use in getSatXvt - /// and getSatHealth - bool strictMethod; - - // Here are a couple of methods to simplify the .cpp - void updateInitialFinal(const OrbElem& eph) - { - if (eph.beginValidfinalTime) - finalTime = eph.endValid; - } - - // virtual void dumpOnePRN( std::ostream& s = std::cout, OrbElemMap& em) const - // throw(); - }; // end class //@} diff --git a/ext/lib/GNSSEph/GloEphemerisStore.cpp b/ext/lib/GNSSEph/GloEphemerisStore.cpp old mode 100644 new mode 100755 index 59bd1db33..5d5a21e7d --- a/ext/lib/GNSSEph/GloEphemerisStore.cpp +++ b/ext/lib/GNSSEph/GloEphemerisStore.cpp @@ -105,7 +105,7 @@ namespace gpstk // Check that the given epoch is within the available time limits. // We have to add a margin of 15 minutes (900 seconds). if ( epoch < (initialTime - 900.0) || - epoch >= (finalTime + 900.0) ) + epoch > (finalTime + 900.0) ) { InvalidRequest e( "Requested time is out of boundaries for satellite " + StringUtils::asString(sat) ); @@ -388,8 +388,8 @@ namespace gpstk { // Check that the given epoch is within the available time limits. // We have to add a margin of 15 minutes (900 seconds). - if ( epoch < (initialTime - 900.0) || - epoch >= (finalTime + 900.0) ) + if ( epoch < (initialTime - 900.0) || + epoch > (finalTime + 900.0) ) { InvalidRequest e( "Requested time is out of boundaries for satellite " + StringUtils::asString(sat) ); @@ -429,8 +429,8 @@ namespace gpstk // Check that the given epoch is within the available time limits for // this specific satellite, with a margin of 15 minutes (900 seconds). - if ( epoch < (i->first - 900.0) || - epoch >= (i->first + 900.0) ) + if ( epoch < (i->first - 900.0) || + epoch > (i->first + 900.0) ) { InvalidRequest e( "Requested time is out of boundaries for satellite " + StringUtils::asString(sat) ); diff --git a/ext/lib/GNSSEph/OrbElem.cpp b/ext/lib/GNSSEph/OrbElem.cpp old mode 100644 new mode 100755 index 711d81629..bc3cce48e --- a/ext/lib/GNSSEph/OrbElem.cpp +++ b/ext/lib/GNSSEph/OrbElem.cpp @@ -53,13 +53,8 @@ namespace gpstk using namespace std; using namespace gpstk; OrbElem::OrbElem() - :dataLoadedFlag(false), - ctToe(CommonTime::BEGINNING_OF_TIME), - ctToc(CommonTime::BEGINNING_OF_TIME), - beginValid(CommonTime::BEGINNING_OF_TIME), - endValid(CommonTime::BEGINNING_OF_TIME) + :ctToc(CommonTime::BEGINNING_OF_TIME) { - healthy = false; ctToe.setTimeSystem(TimeSystem::GPS); ctToc.setTimeSystem(TimeSystem::GPS); beginValid.setTimeSystem(TimeSystem::GPS); @@ -84,6 +79,60 @@ namespace gpstk return(dataLoadedFlag); } + bool OrbElem::isSameData(const OrbElem* right) const + { + if (!OrbElemBase::isSameData(right)) return false; + if (Cuc != right->Cuc) return false; + if (Cus != right->Cus) return false; + if (Crc != right->Crc) return false; + if (Crs != right->Crs) return false; + if (Cic != right->Cic) return false; + if (Cis != right->Cis) return false; + if (M0 != right->M0) return false; + if (dn != right->dn) return false; + if (dndot != right->dndot) return false; + if (ecc != right->ecc) return false; + if (A != right->A) return false; + if (Adot != right->Adot) return false; + if (OMEGA0 != right->OMEGA0) return false; + if (i0 != right->i0) return false; + if (w != right->w) return false; + if (OMEGAdot != right->OMEGAdot) return false; + if (idot != right->idot) return false; + if (ctToc != right->ctToc) return false; + if (af0 != right->af0) return false; + if (af1 != right->af1) return false; + if (af2 != right->af2) return false; + return true; + } + + std::list OrbElem::compare(const OrbElem* right) const + { + std::list retList = OrbElemBase::compare(right); + if (Cuc != right->Cuc) retList.push_back("Cuc"); + if (Cus != right->Cus) retList.push_back("Cus"); + if (Crc != right->Crc) retList.push_back("Crc"); + if (Crs != right->Crs) retList.push_back("Crs"); + if (Cic != right->Cic) retList.push_back("Cic"); + if (Cis != right->Cis) retList.push_back("Cis"); + if (M0 != right->M0) retList.push_back("M0"); + if (dn != right->dn) retList.push_back("dn"); + if (dndot != right->dndot) retList.push_back("dndot"); + if (ecc != right->ecc) retList.push_back("ecc"); + if (A != right->A) retList.push_back("A"); + if (Adot != right->Adot) retList.push_back("Adot"); + if (OMEGA0 != right->OMEGA0) retList.push_back("OMEGA0"); + if (i0 != right->i0) retList.push_back("i0"); + if (w != right->w) retList.push_back("w"); + if (OMEGAdot != right->OMEGAdot) retList.push_back("OMEGAdot"); + if (idot != right->idot) retList.push_back("idot"); + if (ctToc != right->ctToc) retList.push_back("ctToc"); + if (af0 != right->af0) retList.push_back("af0"); + if (af1 != right->af1) retList.push_back("af1"); + if (af2 != right->af2) retList.push_back("af2"); + return retList; + } + bool OrbElem::isHealthy() const throw(InvalidRequest) { diff --git a/ext/lib/GNSSEph/OrbElem.hpp b/ext/lib/GNSSEph/OrbElem.hpp old mode 100644 new mode 100755 index e6dd70a88..14109cf78 --- a/ext/lib/GNSSEph/OrbElem.hpp +++ b/ext/lib/GNSSEph/OrbElem.hpp @@ -52,6 +52,7 @@ #ifndef GPSTK_ORBELEM_HPP #define GPSTK_ORBELEM_HPP +#include "OrbElemBase.hpp" #include "ObsID.hpp" #include "Exception.hpp" #include "CommonTime.hpp" @@ -65,7 +66,7 @@ namespace gpstk { - class OrbElem + class OrbElem : public OrbElemBase { public: /// Constructors @@ -103,6 +104,10 @@ namespace gpstk virtual std::string getNameLong() const = 0; + virtual bool isSameData(const OrbElem* right) const; + + virtual std::list compare(const OrbElem* right) const; + /** This function returns the health status of the SV. * @throw Invalid Request if the required data has not been stored. */ @@ -173,12 +178,12 @@ namespace gpstk throw( InvalidRequest ); /// Overhead information - //@{ - bool dataLoadedFlag; /**< True if data is present, False otherwise */ - SatID satID; /**< Define satellite system and specific SV */ - ObsID obsID; /**< Defines carrier and tracking code */ - CommonTime ctToe; /**< Orbit epoch in commontime format */ - bool healthy; /**< SV health (healthy=true, other=false */ + //@{ // Moved to OrbElemBase + //bool dataLoadedFlag; /**< True if data is present, False otherwise */ + //SatID satID; /**< Define satellite system and specific SV */ + //ObsID obsID; /**< Defines carrier and tracking code */ + //CommonTime ctToe; /**< Orbit epoch in commontime format */ + //bool healthy; /**< SV health (healthy=true, other=false */ //@} /// Harmonic perturbations @@ -229,8 +234,8 @@ namespace gpstk // and endValid are derived. //@{ - CommonTime beginValid; /**< Time at beginning of validity */ - CommonTime endValid; /**< Time at end of fit validity */ + //CommonTime beginValid; /**< Time at beginning of validity */ + //CommonTime endValid; /**< Time at end of fit validity */ diff --git a/ext/lib/GNSSEph/OrbElemBase.cpp b/ext/lib/GNSSEph/OrbElemBase.cpp new file mode 100755 index 000000000..3349abb7d --- /dev/null +++ b/ext/lib/GNSSEph/OrbElemBase.cpp @@ -0,0 +1,153 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= +/** + * @file OrbElemBase.cpp + * OrbElemBase data encapsulated in engineering terms + */ + +#include "OrbElemBase.hpp" +#include "StringUtils.hpp" +#include "GPSEllipsoid.hpp" +#include "YDSTime.hpp" +#include "CivilTime.hpp" +#include "TimeSystem.hpp" +#include "TimeString.hpp" +#include "MathBase.hpp" + + +namespace gpstk +{ + using namespace std; + using namespace gpstk; + OrbElemBase::OrbElemBase() + :dataLoadedFlag(false), + ctToe(CommonTime::BEGINNING_OF_TIME), + beginValid(CommonTime::BEGINNING_OF_TIME), + endValid(CommonTime::BEGINNING_OF_TIME) + { + healthy = false; + } + + bool OrbElemBase::isValid(const CommonTime& ct) const + throw(InvalidRequest) + { + if (!dataLoaded()) + { + InvalidRequest exc("Required data not stored."); + GPSTK_THROW(exc); + } + if (ct >= beginValid && ct <= endValid) return(true); + return(false); + } + + + bool OrbElemBase::dataLoaded() const + { + return(dataLoadedFlag); + } + + bool OrbElemBase::isHealthy() const + throw(InvalidRequest) + { + if (!dataLoaded()) + { + InvalidRequest exc("Required data not stored."); + GPSTK_THROW(exc); + } + return(healthy); + } + + // Compare the data contents of two OrbElemBase objects. + // + bool OrbElemBase::isSameData(const OrbElemBase* right) const + { + if (dataLoadedFlag != right->dataLoadedFlag) return false; + if (satID != right->satID) return false; + if (obsID != right->obsID) return false; + if (ctToe != right->ctToe) return false; + if (healthy != right->healthy) return false; + if (beginValid != right->beginValid) return false; + if (endValid != right->endValid) return false; + return true; + } + + // Compare, but also return a list of all differences found + std::list OrbElemBase::compare(const OrbElemBase* right) const + { + std::list retList; + if (dataLoadedFlag != right->dataLoadedFlag) retList.push_back("dataLoadedFlag"); + if (satID != right->satID) retList.push_back("satID"); + if (obsID != right->obsID) retList.push_back("obsID"); + if (ctToe != right->ctToe) retList.push_back("ctToe"); + if (healthy != right->healthy) retList.push_back("healthy"); + if (beginValid != right->beginValid) retList.push_back("beginValid"); + if (endValid != right->endValid) retList.push_back("endValid"); + return retList; + } + + // The base dump method exists in order that a dump() with + // minimum functionality is guaranteed to exist. The + // test that the data are loaded is implemented, the header, + // body, and footer are called, and any output formats are + // preserved. + void OrbElemBase::dump(ostream& s) const + throw( InvalidRequest ) + { + if (!dataLoaded()) + { + InvalidRequest exc("Required data not stored."); + GPSTK_THROW(exc); + } + const ios::fmtflags oldFlags = s.flags(); + + dumpHeader(s); + dumpBody(s); + dumpFooter(s); + + s.flags(oldFlags); + } + + + Rinex3NavData OrbElemBase::makeRinex3NavData() const + throw( InvalidRequest ) + { + InvalidRequest ir("Method makeRinex3NavData() not implemented."); + GPSTK_THROW(ir); + } + + + +} // namespace diff --git a/ext/lib/GNSSEph/OrbElemBase.hpp b/ext/lib/GNSSEph/OrbElemBase.hpp new file mode 100755 index 000000000..f35c3e523 --- /dev/null +++ b/ext/lib/GNSSEph/OrbElemBase.hpp @@ -0,0 +1,213 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/** + * @file OrbElemBase.hpp + * This class encapsulates the "least common denominator" interface + * to GNSS orbits. Note that OrbElem was defined PRIOR to OrbElemBase. + * However, we then needed to handle GLONASS, which uses a tabular + * orbit rather than pseudo-Keplerian elements. As a result, we + * need a virtual base class that defined a common interface to + * key functionality without in any way defining how that functionality + * is implemented. This was necessary in order that OrbElemStore could + * serve as a storage base for all the derived orbit classes. + * + * Obviously, user will need to instantiate a descendent of this + * class as opposed to instantiating this class directly. The + * descendent classes provide the functionality to load the + * coefficients from various navigation message formats + * and types and then manipulate the data to produce SV positions, + * clock offsets, and status information. + */ + +#ifndef GPSTK_ORBELEMBASE_HPP +#define GPSTK_ORBELEMBASE_HPP + +#include "Exception.hpp" +#include "CommonTime.hpp" +#include "Xvt.hpp" +#include "GNSSconstants.hpp" +#include "SatID.hpp" +#include "ObsID.hpp" +#include "Rinex3NavData.hpp" +//#include "MathBase.hpp" + +namespace gpstk +{ + class OrbElemBase + { + public: + /// Constructors + /// Default constuctor + OrbElemBase( ); + + + /// Destructor + virtual ~OrbElemBase() {} + + /// Clone method. + /// Return pointer to new copy of this type. + /// Implication of the "= 0" at this end is that this is a + /// "pure virtual" method and that makes OrbElemBase an abstract + /// class. That is to say no objects of type OrbElemBase may + /// be constructed. This is a good thing since OrbElemBase + /// doesn't even provide methods to load its' members. + /// Only its' descendents may be instantiated. + virtual OrbElemBase* clone() const = 0; + + /** + * Returns true if the time, ct, is within the period of validity of this + * OrbElemBase object. + * @throw Invalid Request if the required data has not been stored. + */ + virtual bool isValid(const CommonTime& ct) const throw(InvalidRequest); + + /** + * Return true if orbit data have been loaded. + * Returns false if the object has been instantiated, + * but no data have been loaded. + */ + virtual bool dataLoaded( ) const; + + virtual std::string getName() const = 0; + + virtual std::string getNameLong() const = 0; + + /** This function returns the health status of the SV. + * @throw Invalid Request if the required data has not been stored. + */ + bool isHealthy() const throw(gpstk::InvalidRequest); + + /** Compute the satellite clock bias (sec) at the given time + * @throw Invalid Request if the required data has not been stored. + */ + virtual double svClockBias(const CommonTime& t) const throw(gpstk::InvalidRequest) = 0; + + /** Compute the satellite clock bias (meters) at the given time + * @throw Invalid Request if the required data has not been stored. + */ + virtual double svClockBiasM(const CommonTime& t) const throw(gpstk::InvalidRequest) = 0; + + /** Compute the satellite clock drift (sec/sec) at the given time + * @throw Invalid Request if the required data has not been stored. + */ + virtual double svClockDrift(const CommonTime& t) const throw(gpstk::InvalidRequest) = 0; + + + /** Compute satellite position at the given time + * using this orbit data. + * @throw Invalid Request if the required data has not been stored. + */ + virtual Xvt svXvt(const CommonTime& t) const throw(gpstk::InvalidRequest) = 0; + + /** Compute satellite relativity correction (sec) at the given time + * @throw Invalid Request if the required data has not been stored. + */ + virtual double svRelativity(const CommonTime& t) const throw( gpstk::InvalidRequest ) = 0; + + /** Returns true if this two objects are + * a.) same concrete type, and + * b.) same data contents. + * This is intended as a "data uniqueness test" to allow + * detection of successive transmissions of same data + * and avoid duplicate storage. The exact rules for + * uniqueness will vary by descendent class. + * NOTE: This would be better as a pure virtual method. + * However, it came about late in the process, so it is + * implemmented here as a stub that returns false. This + */ + virtual bool isSameData(const OrbElemBase* right) const; + + /** Compare two OrbElemBase descendent objects. + * Any differences are summarized and written to the output stream + * provided. + * The base method compares the members common to the base. The descendent classes + * should add additional member comparisions as needed in order + * to provide a complete comparison of members of interest to be compared. + * The return list is a list of the members that disagreed. + */ + virtual std::list compare(const OrbElemBase* right) const; + + /** Output the contents of this orbit data to the given stream. + * @throw Invalid Request if the required data has not been stored. + */ + virtual void dumpTerse(std::ostream& s = std::cout) const + throw( InvalidRequest ) = 0; + + virtual void dumpHeader(std::ostream& s = std::cout) const + throw( InvalidRequest ) = 0; + + virtual void dumpBody(std::ostream& s = std::cout) const + throw( InvalidRequest ) = 0; + + virtual void dumpFooter(std::ostream& s = std::cout) const + throw( InvalidRequest ) = 0; + + virtual void dump(std::ostream& s = std::cout) const + throw( InvalidRequest ); + + virtual Rinex3NavData makeRinex3NavData() const + throw( InvalidRequest ); + + /// Overhead information + //@{ + bool dataLoadedFlag; /**< True if data is present, False otherwise */ + SatID satID; /**< Define satellite system and specific SV */ + ObsID obsID; /**< Defines carrier and tracking code */ + CommonTime ctToe; /**< Orbit epoch in commontime format */ + bool healthy; /**< SV health (healthy=true, other=false */ + //@} + + // Fit Interval Definition + // The beginning and end of validity are derived quantities that specify + // the bounds between which the data in OrbElemBase are valid. + // The manner in which these are derived varies by satellite system, + // but the bounds are required for proper operation of the navigation + // message storage classes. + + //@{ + CommonTime beginValid; /**< Time at beginning of validity */ + CommonTime endValid; /**< Time at end of fit validity */ + + + + }; // end class OrbElemBase + + //@} + +} // end namespace + +#endif // GPSTK_ORBELEMBASE_HPP diff --git a/ext/lib/GNSSEph/OrbElemStore.cpp b/ext/lib/GNSSEph/OrbElemStore.cpp new file mode 100755 index 000000000..6b6f02d47 --- /dev/null +++ b/ext/lib/GNSSEph/OrbElemStore.cpp @@ -0,0 +1,667 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/** + * @file OrbElemStore.cpp + * Store GNSS broadcast OrbElemBase information, and access by + * satellite and time. Several of the "least common denominator" + * methods are defined in this base class, several are over-ridden + * by descendent classes. + */ + +#include +#include +#include + +#include "StringUtils.hpp" +#include "OrbElemStore.hpp" +#include "MathBase.hpp" +#include "CivilTime.hpp" +#include "TimeString.hpp" + +using namespace std; +using gpstk::StringUtils::asString; + + +namespace gpstk +{ + +//-------------------------------------------------------------------------- + + Xvt OrbElemStore::getXvt(const SatID& sat, const CommonTime& t) const + throw( InvalidRequest ) + { + try + { + // Find appropriate orbit elements (if available) + const OrbElemBase* eph = findOrbElem(sat,t); + + // If the orbital elements are unhealthy, refuse to + // calculate an SV position and throw. + if (!eph->healthy) + { + InvalidRequest exc( std::string("SV is transmitting unhealhty navigation ") + + std::string("message at time of interest.") ); + GPSTK_THROW( exc ); + } + Xvt sv = eph->svXvt(t); + return sv; + } + catch(InvalidRequest& ir) + { + GPSTK_RETHROW(ir); + } + } + +//------------------------------------------------------------------------------ + + void OrbElemStore::validSatSystem(const SatID& sat) const + throw( InvalidRequest ) + { + if (!isSatSysPresent(sat.system)) + { + stringstream ess; + ess << "Store does not contain orbit/clock elements for system "; + ess << sat.system; + ess << ". " << endl; + ess << " Valid systems are :" << endl; + + list::const_iterator cit; + for (cit=sysList.begin();cit!=sysList.end();cit++) + { + SatID::SatelliteSystem ssTest = *cit; + ess << SatID::convertSatelliteSystemToString(ssTest) << endl; + } + + InvalidRequest ir(ess.str()); + GPSTK_THROW(ir); + } + } + +//-------------------------------------------------------------------------- + + bool OrbElemStore::isHealthy(const SatID& sat, const CommonTime& t) const + throw( InvalidRequest ) + { + try + { + validSatSystem(sat); + + // Find appropriate orbit elements (if available) + const OrbElemBase* eph = findOrbElem(sat, t); + + return eph->isHealthy(); + } + catch(InvalidRequest& ir) + { + GPSTK_RETHROW(ir); + } + } // end of OrbElemStore::getHealth() + +//-------------------------------------------------------------------------- +// Typically overridden by descendents to obtain system-specific +// listing behavior. + + void OrbElemStore::dump(std::ostream& s, short detail) const + throw() + { + UBEMap::const_iterator it; + static const string fmt("%04Y/%02m/%02d %02H:%02M:%02S %P"); + + s << "Dump of OrbElemStore:\n"; + if (detail==0) + { + s << " Span is " << (initialTime == CommonTime::END_OF_TIME + ? "End_time" : printTime(initialTime,fmt)) + << " to " << (finalTime == CommonTime::BEGINNING_OF_TIME + ? "Begin_time" : printTime(finalTime,fmt)) + << " with " << size() << " entries." + << std::endl; + } // end if-block + else if (detail==1) + { + for (it = ube.begin(); it != ube.end(); it++) + { + const OrbElemMap& em = it->second; + s << " Orbit/clock list for satellite " << it->first + << " has " << em.size() << " entries." << std::endl; + OrbElemMap::const_iterator ei; + + for (ei = em.begin(); ei != em.end(); ei++) + { + const OrbElemBase* oe = ei->second; + s << "PRN " << setw(2) << it->first + << " TOE " << printTime(oe->ctToe,fmt) + << " KEY " << printTime(ei->first,fmt); + s << " begVal: " << printTime(oe->beginValid,fmt) + << " endVal: " << printTime(oe->endValid,fmt); + + s << std::endl; + } //end inner for-loop */ + + } // end outer for-loop + + //s << " End of Orbit/Clock data." << std::endl << std::endl; + + } //end else-block + } // end OrbElemStore::dump + +//------------------------------------------------------------------------------------ +// Keeps only one OrbElemBase for a given SVN and Toe. +// It should keep the one with the earliest transmit time. +//------------------------------------------------------------------------------------ + bool OrbElemStore::addOrbElem(const OrbElemBase* eph) + throw(InvalidParameter,Exception) + { + try + { + + SatID sid = eph->satID; + OrbElemMap& oem = ube[sid]; + string ts = "%02m/%02d/%02y %02H:%02M:%02S"; + + // If satellite system is wrong type for this store, throw an error + if (!isSatSysPresent(sid.system)) + { + stringstream ess; + ess << "Attempted to add orbit elements for satellite"; + ess << sid; + ess << " and that satellite system is not contained in this store."; + InvalidParameter ip(ess.str()); + GPSTK_THROW(ip); + } + + // if map is empty, load object and return + if (oem.size()==0) + { + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + // Search for beginValid in current keys. + // If found candidate, should be same data + // as already in table. Test this by comparing + // Toe values. + OrbElemMap::iterator it = oem.find(eph->beginValid); + if(it!=oem.end()) + { + const OrbElemBase* oe = it->second; + // Found duplicate already in table + if(oe->ctToe==eph->ctToe) + { + return (false); + } + // Found matching beginValid but different Toe - This shouldn't happen + else + { + string str = "Unexpectedly found matching beginValid times"; + stringstream os; + os << eph->satID; + str += " but different Toe. SV = " + os.str(); + str += ", beginValid= " + printTime(eph->beginValid,ts); + str += ", Toe(map)= " + printTime(eph->ctToe,ts); + str += ", Toe(candidate)= "+ printTime(oe->ctToe," %6.0g"); + str += ". "; + InvalidParameter exc( str ); + GPSTK_THROW(exc); + } + } + // Did not already find match to + // beginValid in map + // N.B:: lower_bound will reutrn element beyond key since there is no match + it = oem.lower_bound(eph->beginValid); + // Case where candidate is before beginning of map + if(it==oem.begin()) + { + const OrbElemBase* oe = it->second; + if(oe->ctToe==eph->ctToe) + { + oem.erase(it); + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + // Case where candidate is after end of current map + if(it==oem.end()) + { + // Get last item in map and check Toe + OrbElemMap::reverse_iterator rit = oem.rbegin(); + const OrbElemBase* oe = rit->second; + if(oe->ctToe!=eph->ctToe) + { + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + return (false); + } + // case where candidate is "In the middle" + // Check if iterator points to late transmission of + // same OrbElem as candidate + const OrbElemBase* oe = it->second; + if(oe->ctToe==eph->ctToe) + { + oem.erase(it); + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + // Two cases: + // (a.) Candidate is late transmit copy of + // previous OrbElemBase in table - discard (do nothing) + // (b.) Candidate OrbElemBase is not in table + + // Already checked for it==oem.beginValid() earlier + it--; + const OrbElemBase* oe2 = it->second; + if(oe2->ctToe!=eph->ctToe) + { + oem[eph->beginValid] = eph->clone(); + updateInitialFinal(eph); + return (true); + } + return (false); + + } + catch(Exception& e) + { + GPSTK_RETHROW(e) + } + } + +//----------------------------------------------------------------------------- + + void OrbElemStore::edit(const CommonTime& tmin, const CommonTime& tmax) + throw() + { + for(UBEMap::iterator i = ube.begin(); i != ube.end(); i++) + { + OrbElemMap& eMap = i->second; + + OrbElemMap::iterator lower = eMap.lower_bound(tmin); + if (lower != eMap.begin()) + { + for (OrbElemMap::iterator emi = eMap.begin(); emi != lower; emi++) + delete emi->second; + eMap.erase(eMap.begin(), lower); + } + + OrbElemMap::iterator upper = eMap.upper_bound(tmax); + if (upper != eMap.end()) + { + for (OrbElemMap::iterator emi = upper; emi != eMap.end(); emi++) + delete emi->second; + eMap.erase(upper, eMap.end()); + } + } + + initialTime = tmin; + finalTime = tmax; + } + +//----------------------------------------------------------------------------- + + unsigned OrbElemStore::size() const + throw() + { + unsigned counter = 0; + for(UBEMap::const_iterator i = ube.begin(); i != ube.end(); i++) + counter += i->second.size(); + return counter; + } + + +//----------------------------------------------------------------------------- + bool OrbElemStore::isPresent(const SatID& id) const + throw() + { + UBEMap::const_iterator ci = ube.find(id); + if (ci==ube.end()) return false; + return true; + } + + +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Goal is to find the set of orbital elements that would have been +// used by a receiver in real-time. That is to say, the most recently +// broadcast elements (assuming the receiver has visibility to the SV +// in question). +//----------------------------------------------------------------------------- + + const OrbElemBase* + OrbElemStore::findOrbElem(const SatID& sat, const CommonTime& t) const + throw( InvalidRequest ) + { + // Check to see that there exists a map of orbital elements + // relevant to this SV. + UBEMap::const_iterator prn_i = ube.find(sat); + if (prn_i == ube.end()) + { + InvalidRequest e("No orbital elements for satellite " + asString(sat)); + GPSTK_THROW(e); + } + + // Define reference to the relevant map of orbital elements + const OrbElemMap& em = prn_i->second; + + // The map is ordered by beginning times of validity, which + // is another way of saying "earliest transmit time". A call + // to em.lower_bound( t ) will return the element of the map + // with a key "one beyond the key" assuming the t is NOT a direct + // match for any key. + + // First, check for the "direct match" case + OrbElemMap::const_iterator it = em.find(t); + // If that fails, then use lower_bound( ) + if (it == em.end( )) + { + it = em.lower_bound(t); + + // Tricky case here. If the key is beyond the last key in the table, + // lower_bound( ) will return em.end( ). However, this doesn't entirely + // settle the matter. It is theoretically possible that the final + // item in the table may have an effectivity that "stretches" far enough + // to cover time t. Therefore, if it==em.end( ) we need to check + // the period of validity of the final element in the table against + // time t. + // + if (it==em.end()) + { + OrbElemMap::const_reverse_iterator rit = em.rbegin(); + if (rit->second->isValid(t)) return(rit->second); // Last element in map works + + // We reached the end of the map, checked the end of the map, + // and we still have nothing. + string mess = "All orbital elements found for satellite " + asString(sat) + " are too early for time " + + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); + InvalidRequest e(mess); + GPSTK_THROW(e); + } + } + + // If the algorithm found a direct match, then we should + // probably use the PRIOR set since it takes ~30 seconds + // from beginning of transmission to complete reception. + // If lower_bound( ) was called, it points to the element + // after the time of the key. + // So either way, it points ONE BEYOND the element we want. + // + // The exception is if it is pointing to em.begin( ). If that is the case, + // then all of the elements in the map are too late. + if (it==em.begin()) + { + string mess = "All orbital elements found for satellite " + asString(sat) + " are too late for time " + + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); + InvalidRequest e(mess); + GPSTK_THROW(e); + } + + // The iterator should be a valid iterator and set one beyond + // the item of interest. However, there may be gaps in the + // middle of the map and cases where periods of effectivity do + // not overlap. That's OK, the key represents the EARLIEST + // time the elements should be used. Therefore, we can + // decrement the counter and test to see if the element is + // valid. + it--; + if (!(it->second->isValid(t))) + { + // If we reach this throw, the cause is a "hole" in the middle of a map. + string mess = "No orbital elements found for satellite " + asString(sat) + " at " + + (static_cast(t)).printf("%02m/%02d/%04Y %02H:%02M:%02S %P"); + InvalidRequest e(mess); + GPSTK_THROW(e); + } + return(it->second); + } + + +//----------------------------------------------------------------------------- + + const OrbElemBase* + OrbElemStore::findNearOrbElem(const SatID& sat, const CommonTime& t) const + throw(InvalidRequest) + { + // Check for any OrbElem for this SV + UBEMap::const_iterator prn_i = ube.find(sat); + if (prn_i == ube.end()) + { + InvalidRequest e("No OrbElem for satellite " + asString(sat)); + GPSTK_THROW(e); + } + + // FIRST, try to find the elements that were + // actually being broadcast at the time of + // interest. That will ALWAYS be the most + // correct response. IF YOU REALLY THINK + // OTHERWISE CALL ME AND LET'S TALK ABOUT + // IT - Brent Renfro + try + { + const OrbElemBase* oep = findOrbElem(sat, t); + return(oep); + } + // No OrbElemBase in store for requested sat time + catch(InvalidRequest) + { + // Create references to map for this satellite + const OrbElemMap& em = prn_i->second; + /* + Three Cases: + 1. t is within a gap within the store + 2. t is before all OrbElemBase in the store + 3. t is after all OrbElemBase in the store + */ + + // Attempt to find next in store after t + OrbElemMap::const_iterator itNext = em.lower_bound(t); + // Test for case 2 + if(itNext==em.begin()) + { + return(itNext->second); + } + // Test for case 3 + if(itNext==em.end()) + { + OrbElemMap::const_reverse_iterator rit = em.rbegin(); + return(rit->second); + } + // Handle case 1 + // Know that itNext is not the beginning, so safe to decrement + CommonTime nextBeginValid = itNext->first; + OrbElemMap::const_iterator itPrior = itNext; + itPrior--; + CommonTime lastEndValid = itPrior->second->endValid; + double diffToNext = nextBeginValid-t; + double diffFromLast = t - lastEndValid; + if(diffToNext>diffFromLast) + { + return(itPrior->second); + } + return(itNext->second); + } + } + +//----------------------------------------------------------------------------- + const OrbElemBase* OrbElemStore:: + findToe(const SatID& sat, const CommonTime& t) + const throw(InvalidRequest) + { + // If the TimeSystem of the requested t doesn't match + // the TimeSystem stored in this store, throw an error. + if (timeSysForStore!=t.getTimeSystem()) + { + std::stringstream ss; + ss << "Mismatched TimeSystems. Time system of store: "; + ss << timeSysForStore << ", Time system of argument: "; + ss << t.getTimeSystem(); + InvalidRequest e(ss.str()); + GPSTK_THROW(e); + } + + // Check for any OrbElem for this SV + UBEMap::const_iterator prn_i = ube.find(sat); + if (prn_i == ube.end()) + { + InvalidRequest e("No OrbElem for satellite " + asString(sat)); + GPSTK_THROW(e); + } + + // Create a reference to map for this satellite + const OrbElemMap& em = prn_i->second; + + // We are looking for an exact match for a Toe. + // The map is keyed with the beginValid time, so the + // only way to determine if there is a match is to iterate + // over the map and check. + OrbElemMap::const_iterator cit; + for (cit=em.begin();cit!=em.end();cit++) + { + const OrbElemBase* candidate = cit->second; + if (candidate->ctToe==t) return(candidate); + } + + // If we reached this point, we didn't find a match. + std::stringstream ss; + ss << "No match found for SV " << sat; + ss << " with Toe " << printTime(t,"%02m/%02d/%04Y %02H:%02M:%02S"); + InvalidRequest e(ss.str()); + GPSTK_THROW(e); + + // Keep the compiler happy. + OrbElemBase* dummy = 0; + return(dummy); + } + + +//----------------------------------------------------------------------------- + + int OrbElemStore::addToList(std::list& v) const + throw() + { + int n = 0; + UBEMap::const_iterator prn_i; + for (prn_i = ube.begin(); prn_i != ube.end(); prn_i++) + { + const OrbElemMap& em = prn_i->second; + OrbElemMap::const_iterator ei; + for (ei = em.begin(); ei != em.end(); ei++) + { + v.push_back(ei->second->clone()); + n++; + } + } + return n; + } + +//----------------------------------------------------------------------------- + + /// Remove all data from this collection. + void OrbElemStore::clear() + throw() + { + for( UBEMap::iterator ui = ube.begin(); ui != ube.end(); ui++) + { + OrbElemMap& oem = ui->second; + for (OrbElemMap::iterator oi = oem.begin(); oi != oem.end(); oi++) + { + delete oi->second; + } + } + ube.clear(); + initialTime = gpstk::CommonTime::END_OF_TIME; + finalTime = gpstk::CommonTime::BEGINNING_OF_TIME; + initialTime.setTimeSystem(timeSysForStore); + finalTime.setTimeSystem(timeSysForStore); + } + +//----------------------------------------------------------------------------- + + const OrbElemStore::OrbElemMap& + OrbElemStore::getOrbElemMap( const SatID& sat ) const + throw( InvalidRequest ) + { + validSatSystem(sat); + + UBEMap::const_iterator prn_i = ube.find(sat); + if (prn_i == ube.end()) + { + InvalidRequest e("No OrbElemBase for satellite " + asString(sat)); + GPSTK_THROW(e); + } + return(prn_i->second); + } + +//----------------------------------------------------------------------------- + + list OrbElemStore::getSatIDList() const + { + list retList; + for( UBEMap::const_iterator ui = ube.begin(); ui != ube.end(); ui++) + { + SatID sid = ui->first; + retList.push_back(sid); + } + return retList; + } + + +//----------------------------------------------------------------------------- + + bool OrbElemStore::isSatSysPresent(const SatID::SatelliteSystem ss) const + { + list::const_iterator cit; + for (cit=sysList.begin();cit!=sysList.end();cit++) + { + SatID::SatelliteSystem ssTest = *cit; + if (ssTest==ss) return true; + } + return false; + } + + void OrbElemStore::addSatSys(const SatID::SatelliteSystem ss) + { + sysList.push_back(ss); + } + + +} // namespace diff --git a/ext/lib/GNSSEph/OrbElemStore.hpp b/ext/lib/GNSSEph/OrbElemStore.hpp old mode 100644 new mode 100755 index 8336e4167..fba75f40a --- a/ext/lib/GNSSEph/OrbElemStore.hpp +++ b/ext/lib/GNSSEph/OrbElemStore.hpp @@ -36,18 +36,26 @@ /** * @file OrbElemStore.hpp - * Abstract base class for storing and/or computing position, velocity, - * and clock data. + * Base class for storing and/or computing position, velocity, + * and clock data. This class is typically extended in order + * to implement SV-system specific behavior. Theoretically, + * it could be used to store OrbElemBase objects across multiple + * systems, but that would entail moving all the time tags to a + * common system. */ #ifndef GPSTK_ORBELEMSTORE_HPP #define GPSTK_ORBELEMSTORE_HPP #include +#include +#include +#include "CommonTime.hpp" #include "Exception.hpp" +#include "OrbElemBase.hpp" #include "SatID.hpp" -#include "CommonTime.hpp" +#include "TimeSystem.hpp" #include "XvtStore.hpp" namespace gpstk @@ -55,7 +63,7 @@ namespace gpstk /** @addtogroup ephemstore */ //@{ - /// Abstract base class for storing and accessing an objects position, + /// Base class for storing and accessing an objects position, /// velocity, and clock data. Also defines a simple interface to remove /// data that has been added. class OrbElemStore : public XvtStore @@ -64,8 +72,13 @@ namespace gpstk OrbElemStore() throw() - {} - + :initialTime(CommonTime::END_OF_TIME), + finalTime(CommonTime::BEGINNING_OF_TIME), + timeSysForStore(TimeSystem::Any) + { + initialTime.setTimeSystem(timeSysForStore); + finalTime.setTimeSystem(timeSysForStore); + } virtual ~OrbElemStore() {} @@ -79,28 +92,32 @@ namespace gpstk /// reason, this is thrown. The text may have additional /// information as to why the request failed. virtual Xvt getXvt(const SatID& id, const CommonTime& t) - const throw( InvalidRequest ) - = 0; + const throw( InvalidRequest ); /// A debugging function that outputs in human readable form, /// all data stored in this object. /// @param[in] s the stream to receive the output; defaults to cout /// @param[in] detail the level of detail to provide virtual void dump(std::ostream& s = std::cout, short detail = 0) - const throw() - {} + const throw(); + + /// + /// + virtual bool isHealthy(const SatID& sat, const CommonTime& t) + const throw(InvalidRequest); + + virtual bool addOrbElem(const OrbElemBase* eph) + throw(InvalidParameter,Exception); /// Edit the dataset, removing data outside the indicated time interval /// @param[in] tmin defines the beginning of the time interval /// @param[in] tmax defines the end of the time interval virtual void edit(const CommonTime& tmin, const CommonTime& tmax = CommonTime::END_OF_TIME) - throw() - = 0; + throw(); /// Clear the dataset, meaning remove all data - virtual void clear(void) throw() - = 0; + virtual void clear(void) throw(); /// Determine the earliest time for which this object can successfully /// determine the Xvt for any object. @@ -108,7 +125,8 @@ namespace gpstk /// @throw InvalidRequest This is thrown if the object has no data. virtual CommonTime getInitialTime() const throw() - = 0; + { return initialTime; } + /// Determine the latest time for which this object can successfully /// determine the Xvt for any object. @@ -116,19 +134,120 @@ namespace gpstk /// @throw InvalidRequest This is thrown if the object has no data. virtual CommonTime getFinalTime() const throw() - = 0; + { return finalTime; } + + /// Return the number of orbit/clock elements stored in this store. + virtual unsigned size() const + throw(); virtual bool velocityIsPresent() const throw() - = 0; + { return true; } /// Return true if velocity data is present in the store virtual bool hasVelocity() const throw() - = 0; + { return true; } /// Return true if the given SatID is present in the store - virtual bool isPresent(const SatID& id) const throw() - = 0; + virtual bool isPresent(const SatID& id) const throw(); + + /// Classes to set/access the store TimeSystem information. + TimeSystem getTimeSystem() const { return timeSysForStore; } + void setTimeSystem(const TimeSystem ts) { timeSysForStore = ts; } + + /// Classes to set/test the satellite system list. + bool isSatSysPresent(const SatID::SatelliteSystem ss) const; + void addSatSys(const SatID::SatelliteSystem ss); + void validSatSystem(const SatID& sat) const + throw( InvalidRequest ); + /* + * Explanation of find( ) function for OrbElemStore + * + * The findOrbElem( ) funtion + * does the best possible job of emulating the choice + * that would be made by a real-time user + * + * It is strongly suggested that the user load ALL + * available set of orbital elements into the store, + * regardless of health status. + */ + /// @param sat SatID of satellite of interest + /// @param t time with which to search for OrbElemBase + /// @return a reference to the desired OrbElemBase + /// @throw InvalidRequest object thrown when no OrbElemBase is found + const OrbElemBase* findOrbElem( const SatID& sat, const CommonTime& t ) + const throw( InvalidRequest ); + + /// Find an OrbElemBase for the indicated satellite at time t. The OrbElemBase + /// chosen is the one with HOW time closest to the time t, (i.e. with + /// smallest fabs(t-HOW), but still within the fit interval. + /// @param sat the SV of interest + /// @param t the time of interest + /// @return a reference to desired OrbElemBase + /// @throw InvalidRequest object thrown when no OrbElemBase is found + const OrbElemBase* findNearOrbElem( const SatID& sat, const CommonTime& t ) + const throw( InvalidRequest ); + + /// Find an OrbElemBase for the indicated satellite that has a Toe + /// corresponding to time t. If no such OrbElemBase exists in the store, + /// throw an InvalidRequest exception + /// @param sat the SV of interest + /// @param t the time of interest + /// @return a reference to desired OrbElemBase + /// @throw InvalidRequest object thrown when no OrbElemBase is found + const OrbElemBase* findToe(const SatID& sat, const CommonTime& t) + const throw(InvalidRequest); + + /// Return a list of SatID object representing the satellites that + /// are contained in the store. + /// @return list of SatID objects + std::list getSatIDList() const; + + /// Add all ephemerides to an existing list. + /// @return the number of ephemerides added. + int addToList( std::list& v ) const + throw(); + + /// This is intended to store sets of unique orbital elements for a single SV. + /// The key is the beginning of the period of validity for each set of elements. + typedef std::map OrbElemMap; + + /// Returns a map of the ephemerides available for the specified + /// satellite. Note that the return is specifically chosen as a + /// const reference. The intent is to provide "read only" access + /// for analysis. If the map needs to be modified, see other methods. + const OrbElemMap& getOrbElemMap( const SatID& sat ) const + throw( InvalidRequest ); + + protected: + + /// This is intended to hold all unique OrbElemBase objects for each SV + /// The key is the prn of the SV. + typedef std::map UBEMap; + + /// The map where all EngEphemerides are stored. + UBEMap ube; + + CommonTime initialTime; //< Time of the first OrbElemBase in the store + CommonTime finalTime; //< Time of the last OrbElemBase in the store + + // List of the satellite systems stored in this store. Typically + // only one and set by descendents. + std::list sysList; + + // TimeSystem used in this store. Set by default to "Any", but + // typically overridden by descendents. + TimeSystem timeSysForStore; + + // Here is a method to simplify the .cpp + void updateInitialFinal(const OrbElemBase* eph) + { + if (eph->beginValidbeginValid; + + if (eph->endValid>finalTime) + finalTime = eph->endValid; + } }; // end class diff --git a/ext/lib/GNSSEph/PackedNavBits.cpp b/ext/lib/GNSSEph/PackedNavBits.cpp index 80a2e6c4a..b4f21cca2 100755 --- a/ext/lib/GNSSEph/PackedNavBits.cpp +++ b/ext/lib/GNSSEph/PackedNavBits.cpp @@ -55,7 +55,9 @@ namespace gpstk PackedNavBits::PackedNavBits() : transmitTime(CommonTime::BEGINNING_OF_TIME), bits(900), - bits_used(0) + bits_used(0), + rxID(""), + xMitCoerced(false) { transmitTime.setTimeSystem(TimeSystem::GPS); } @@ -63,18 +65,38 @@ namespace gpstk const ObsID& obsIDArg, const CommonTime& transmitTimeArg) : bits(900), - bits_used(0) + bits_used(0), + rxID(""), + xMitCoerced(false) { satSys = satSysArg; obsID = obsIDArg; transmitTime = transmitTimeArg; + xMitCoerced = false; + } + + PackedNavBits::PackedNavBits(const SatID& satSysArg, + const ObsID& obsIDArg, + const std::string rxString, + const CommonTime& transmitTimeArg) + : bits(900), + bits_used(0), + rxID(""), + xMitCoerced(false) + { + satSys = satSysArg; + obsID = obsIDArg; + rxID = rxString; + transmitTime = transmitTimeArg; + xMitCoerced = false; } // Copy constructor PackedNavBits::PackedNavBits(const PackedNavBits& right) { satSys = right.satSys; - obsID = right.obsID; + obsID = right.obsID; + rxID = right.rxID; transmitTime = right.transmitTime; bits_used = right.bits_used; bits.resize(bits_used); @@ -82,6 +104,7 @@ namespace gpstk { bits[i] = right.bits[i]; } + xMitCoerced = right.xMitCoerced; } /* @@ -117,6 +140,12 @@ namespace gpstk obsID = obsIDArg; return; } + + void PackedNavBits::setRxID(const std::string rxString) + { + rxID = rxString; + return; + } void PackedNavBits::setTime(const CommonTime& TransmitTimeArg) { @@ -139,7 +168,12 @@ namespace gpstk { return(satSys); } - + + std::string PackedNavBits::getRxID() const + { + return(rxID); + } + CommonTime PackedNavBits::getTransmitTime() const { return(transmitTime); @@ -215,7 +249,49 @@ namespace gpstk { double drad = asSignedDouble( startBits, numBits, power2); return (drad*PI); - }; + } + + //---- + /* Unpack a sign/mag long */ + long PackedNavBits::asSignMagLong(const int startBit, + const int numBits, + const int scale) const + { + // Get the magnitude + int startBitMag = startBit + 1; + int numBitsMag = numBits - 1; + unsigned long mag = asUnsignedLong(startBitMag, numBitsMag, scale); + + // Get the sign bit + uint64_t uint = asUint64_t( startBit, 1 ); + + long smag = (long) mag; + if (uint==1) smag *= -1; + return smag; + } + + /* Unpack a sign/mag double */ + double PackedNavBits::asSignMagDouble( const int startBit, + const int numBits, + const int power2) const + { + long smag = asSignMagLong(startBit, numBits, 1); + + // Convert to double and scale + double dval = (double) smag; + dval *= pow(static_cast(2), power2); + return( dval ); + } + + /* Unpack a sign/mag double with units of semi-circles */ + double PackedNavBits::asSignMagDoubleSemiCircles( const int startBit, + const int numBits, + const int power2) const + { + double drad = asSignMagDouble( startBit, numBits, power2); + return (drad*PI); + } + std::string PackedNavBits::asString(const int startBit, const int numChars) const { @@ -232,7 +308,6 @@ namespace gpstk return(out); } - /* Unpack a split unsigned long integer */ unsigned long PackedNavBits::asUnsignedLong(const unsigned startBits[], const unsigned numBits[], @@ -485,7 +560,7 @@ namespace gpstk bits_used += right.bits_used; bits.resize(bits_used); - for (int i=0;i0) + s << " RxID: " << rxID << endl; + s << endl << "Number Of Bits: " << dec << getNumBits() << endl << endl; @@ -630,7 +708,7 @@ namespace gpstk word <<= 32 - numBitInWord; if (numBitInWord>0) { - s << " 0x" << setw(8) << setfill('0') << hex << word; + s << delimiter << " 0x" << setw(8) << setfill('0') << hex << word; } s.flags(oldFlags); // Reset whatever conditions pertained on entry return(bits.size()); @@ -748,7 +826,6 @@ namespace gpstk return; } - ostream& operator<<(ostream& s, const PackedNavBits& pnb) { pnb.dump(s); diff --git a/ext/lib/GNSSEph/PackedNavBits.hpp b/ext/lib/GNSSEph/PackedNavBits.hpp index e45b340f4..9065753ea 100755 --- a/ext/lib/GNSSEph/PackedNavBits.hpp +++ b/ext/lib/GNSSEph/PackedNavBits.hpp @@ -68,6 +68,12 @@ namespace gpstk const ObsID& obsIDArg, const CommonTime& transmitTimeArg); + /// explicit constructor + PackedNavBits(const SatID& satSysArg, + const ObsID& obsIDArg, + const std::string rxString, + const CommonTime& transmitTimeArg); + PackedNavBits(const PackedNavBits& right); // Copy constructor //PackedNavBits& operator=(const PackedNavBits& right); // Copy assignment @@ -75,6 +81,7 @@ namespace gpstk void setSatID(const SatID& satSysArg); void setObsID(const ObsID& obsIDArg); + void setRxID(const std::string rxString); void setTime(const CommonTime& transmitTimeArg); void clearBits(); @@ -84,6 +91,11 @@ namespace gpstk /* Returns Observation type, Carrier, and Tracking Code */ ObsID getobsID() const; + /* Returns string defining the receiver that collected the data. + NOTE: This was a late addition to PackedNavBits and may not + be present in all applications */ + std::string getRxID() const; + /* Returns time of transmission from SV */ CommonTime getTransmitTime() const; @@ -123,6 +135,27 @@ namespace gpstk std::string asString(const int startBit, const int numChars) const; + // The following three methods were added to support + // GLONASS sign/magnitude real values. + // + // Since GLONASS has no disjoint fields (at least not + // up through ICD Edition 5.1) there are no methods + // for unpacking disjoint-field sign/mag quantities. + /* Unpack a sign/mag long */ + long asSignMagLong(const int startBit, + const int numBits, + const int scale) const; + + /* Unpack a sign/mag double */ + double asSignMagDouble( const int startBit, + const int numBits, + const int power2) const; + + /* Unpack a sign/mag double with units of semi-circles */ + double asSignMagDoubleSemiCircles( const int startBit, + const int numBits, + const int power2) const; + /* Unpack mehthods that join multiple disjoint navigation message areas as a single field NOTE: startBit1 is associated with the most significant section @@ -243,12 +276,20 @@ namespace gpstk void rawBitInput(const std::string inString ) throw(InvalidParameter); + void setXmitCoerced(bool tf=true) {xMitCoerced=tf;} + bool isXmitCoerced() const {return xMitCoerced;} + private: SatID satSys; /**< System ID (based on RINEX defintions */ ObsID obsID; /**< Defines carrier and code tracked */ - CommonTime transmitTime; /**< Time nav message is trasnmitted */ + std::string rxID; /**< Defines the receiver that collected the data */ + CommonTime transmitTime; /**< Time nav message is transmitted */ std::vector bits; /**< Holds the packed data */ int bits_used; + + bool xMitCoerced; /**< Used to indicate that the transmit + time is NOT directly derived from + the SOW in the message */ /** Unpack the bits */ uint64_t asUint64_t(const int startBit, const int numBits ) const diff --git a/ext/lib/GNSSEph/Rinex3EphemerisStore.cpp b/ext/lib/GNSSEph/Rinex3EphemerisStore.cpp index ad619743a..8137cf797 100644 --- a/ext/lib/GNSSEph/Rinex3EphemerisStore.cpp +++ b/ext/lib/GNSSEph/Rinex3EphemerisStore.cpp @@ -151,7 +151,7 @@ namespace gpstk + string(" : ") + e.getText(); return -3; } - catch(exception& e) { + catch(std::exception& e) { what = string("std excep: ") + e.what(); return -3; } diff --git a/ext/lib/Geodyn/ReferenceFrames.cpp b/ext/lib/Geodyn/ReferenceFrames.cpp index 15b4c8567..1fd8b4b5b 100644 --- a/ext/lib/Geodyn/ReferenceFrames.cpp +++ b/ext/lib/Geodyn/ReferenceFrames.cpp @@ -1,1304 +1,1304 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// Wei Yan - Chinese Academy of Sciences . 2009, 2010 -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -/** - * @file ReferenceFrames.cpp - * Class to do Reference frame transformation. - */ - -#include "ReferenceFrames.hpp" -#include -#include -#include -#include -#include "StringUtils.hpp" -#include "IERS.hpp" -#include "ASConstant.hpp" - - -namespace gpstk -{ - using namespace std; - - // Objects to handle JPL ephemeris 405 - SolarSystem ReferenceFrames::solarPlanets; - - // Reference epoch (J2000), Julian Date - const double ReferenceFrames::DJ00 = 2451545.0; - - // Conversion offset, Julian Date to Modified Julian Date. - const double ReferenceFrames::JD_TO_MJD = 2400000.5; - - // 2PI - const double ReferenceFrames::D2PI = 6.283185307179586476925287; - - // Days per Julian century - const double ReferenceFrames::DJC = 36525.0; - - // Arcseconds to radians - const double ReferenceFrames::DAS2R = 4.848136811095359935899141e-6; - - // seconds to radians - const double ReferenceFrames::DS2R = 7.272205216643039903848712e-5; - - // Arcseconds in a full circle - const double ReferenceFrames::TURNAS = 1296000.0; - - - /* Compute planet position in J2000 - * - * @param TT Time(Modified Julian Date in TT) of interest - * @param entity The planet to be computed - * @return The position of the planet in km - */ - Vector ReferenceFrames::getJ2kPosition( const CommonTime& TT, - SolarSystem::Planet entity) - throw(Exception) - { - Vector rvJ2k = getJ2kPosVel(TT,entity); - - Vector rJ2k(3,0.0); - for(int i=0; i<3; i++) - { - rJ2k[i] = rvJ2k[i]; - } - - return rJ2k; - } - - /* Compute planet velocity in J2000 - * - * @param TT Time(Modified Julian Date in TT) of interest - * @param entity The planet to be computed - * @return The velocity of the planet in km - */ - Vector ReferenceFrames::getJ2kVelocity( const CommonTime& TT, - SolarSystem::Planet entity) - throw(Exception) - { - Vector rvJ2k = getJ2kPosVel(TT,entity); - - Vector vJ2k(3,0.0); - for(int i = 0; i < 3; i++) - { - vJ2k[i] = rvJ2k[i+3]; - } - - return vJ2k; - } - - /* Compute planet position and velocity - * - * @param TT Time(Modified Julian Date in TT) of interest - * @param entity The planet to be computed - * @param center relative to whick the result apply - * @return The position and velocity of the planet in km and km/s - */ - Vector ReferenceFrames::getJ2kPosVel( const CommonTime& TT, - SolarSystem::Planet entity, - SolarSystem::Planet center) - throw(Exception) - { - Vector rvJ2k(6,0.0); - - try - { - double rvState[6] = {0.0}; - int ret = solarPlanets.computeState(JD_TO_MJD + static_cast(TT).MJD(), - entity, - center, - rvState); - - // change the unit to km/s from km/day - rvState[3] /= 86400.0; - rvState[4] /= 86400.0; - rvState[5] /= 86400.0; - - if(ret == 0) - { - rvJ2k = rvState; - return rvJ2k; - } - else - { - rvJ2k.resize(6,0.0); - - // failed to compute - InvalidRequest e("Failed to compute, error code: " - +StringUtils::asString(ret)+" with meaning\n" - +"-1 and -2 given time is out of the file \n" - +"-3 and -4 input stream is not open or not valid," - +" or EOF was found prematurely"); - - GPSTK_THROW(e); - } - } - catch(Exception& e) - { - GPSTK_RETHROW(e); - } - catch(exception& e) - { - Exception ee(e.what()); - GPSTK_THROW(ee); - } - catch(...) - { - Exception e("Unknown error!"); - GPSTK_THROW(e); - } - - return rvJ2k; - - } // End of method 'ReferenceFrames::getJ2kPosVel()' - - - /* Compute planet position in ECEF - * - * @param UTC Time(Modified Julian Date in UTC) of interest - * @param entity The planet to be computed - * @param center relative to whick the result apply - * @return The position of the planet in km and km/s - */ - Vector ReferenceFrames::getECEFPosition(UTCTime UTC, - SolarSystem::Planet entity, - SolarSystem::Planet center) - throw(Exception) - { - Vector ecefPosVel = getECEFPosVel(UTC, entity, center); - - Vector ecefPos(3,0.0); - ecefPos(0) = ecefPosVel(0); - ecefPos(1) = ecefPosVel(1); - ecefPos(2) = ecefPosVel(2); - - return ecefPos; - } - - /* Compute planet velocity in ECEF - * - * @param UTC Time(Modified Julian Date in UTC) of interest - * @param entity The planet to be computed - * @param center relative to whick the result apply - * @return The position of the planet in km and km/s - */ - Vector ReferenceFrames::getECEFVelocity(UTCTime UTC, - SolarSystem::Planet entity, - SolarSystem::Planet center) - throw(Exception) - { - Vector ecefPosVel = getECEFPosVel(UTC, entity, center); - - Vector ecefVel(3,0.0); - ecefVel(0) = ecefPosVel(3); - ecefVel(1) = ecefPosVel(4); - ecefVel(2) = ecefPosVel(5); - - return ecefVel; - } - - /* Compute planet position and velocity in ECEF - * - * @param UTC Time(Modified Julian Date in UTC) of interest - * @param entity The planet to be computed - * @param center relative to whick the result apply - * @return The position and velocity of the planet in km and km/s - */ - Vector ReferenceFrames::getECEFPosVel( UTCTime UTC, - SolarSystem::Planet entity, - SolarSystem::Planet center) - throw(Exception) - { - Vector j2kPosVel = getJ2kPosVel( UTC.asTT(), entity, center); - Vector ecefPosVel = J2kPosVelToECEF(UTC, j2kPosVel); - - return ecefPosVel; - } - - // ECEF = W * S * NP * J2k - void ReferenceFrames::J2kToECEFMatrix(UTCTime UTC, - Matrix& POM, - Matrix& Theta, - Matrix& NP) - throw(Exception) - { - // Earth orientation data - double xp = UTC.xPole() * DAS2R; - double yp = UTC.yPole() * DAS2R; - - CommonTime TT = UTC.asTT(); - CommonTime UT1 = UTC.asUT1(); - - - // IAU 1976 precession matrix - Matrix P = iauPmat76(TT); - - // Nutation correction wrt IAU 1976/1980 (mas->radians) - const double DDP80 = 0.0; //-55.0655 * DAS2R/1000.0; - const double DDE80 = 0.0; //-6.3580 * DAS2R/1000.0; - - // Nutation angle - double DPSI = 0.0; - double DEPS = 0.0; - nutationAngles(TT, DPSI, DEPS); - - DPSI += DDP80; - DEPS += DDE80; - - // Mean obliquity - double EPSA = meanObliquity(TT); - - // IAU 1980 Nutation matrix - Matrix N = iauNmat(EPSA, DPSI , DEPS); - - // NP - NP = N * P; - - // Euqation of the equinoxes, including nutation correction - double EE = iauEqeq94(TT) + DDP80 * std::cos(EPSA); - - // Greenwich apparent sidereal time(IAU 1982/1994) - double GST = normalizeAngle(iauGmst82(UT1) + EE); - - Theta = Rz(GST); - - // Polar motion matrix - POM = Ry(-xp) * Rx(-yp); - - // All Matrix are ready now - - return; - - } // End of method 'ReferenceFrames::J2kToECEFMatrix()' - - - // return POM * Theta * NP - Matrix ReferenceFrames::J2kToECEFMatrix(UTCTime UTC) - { - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - return (POM * Theta * NP); - } - - /// NP TOD - TrueOfDate - Matrix ReferenceFrames::J2kToTODMatrix(UTCTime UTC) - { - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - return NP; - } - - - Vector ReferenceFrames::J2kPosVelToECEF(UTCTime UTC, Vector j2kPosVel) - throw(Exception) - { - - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - const double dera = earthRotationAngleRate1(UTC.mjdTT()); - - // Derivative of Earth rotation - Matrix S(3,3,0.0); - S(0,1) = 1.0; S(1,0) = -1.0; - - Matrix dTheta = dera * S * Theta; - - Matrix c2t = POM * Theta * NP; - Matrix dc2t = POM * dTheta * NP; - - Vector j2kPos(3, 0.0), j2kVel(3, 0.0); - for(int i=0; i<3; i++) - { - j2kPos(i) = j2kPosVel(i); - j2kVel(i) = j2kPosVel(i+3); - } - - Vector ecefPos = c2t * j2kPos; - Vector ecefVel = c2t * j2kVel + dc2t * j2kPos; - - Vector ecefPosVel(6,0.0); - for(int i=0; i<3; i++) - { - ecefPosVel(i) = ecefPos(i); - ecefPosVel(i+3) = ecefVel(i); - } - - return ecefPosVel; - - } // End of method 'ReferenceFrames::J2kPosVelToECEF()' - - - Vector ReferenceFrames::ECEFPosVelToJ2k(UTCTime UTC, Vector ecefPosVel) - throw(Exception) - { - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - const double dera = earthRotationAngleRate1(UTC.mjdTT()); - - // Derivative of Earth rotation - Matrix S(3,3,0.0); - S(0,1) = 1.0; S(1,0) = -1.0; - - Matrix dTheta = dera * S * Theta; - - Matrix c2t = POM * Theta * NP; - Matrix dc2t = POM * dTheta * NP; - - Vector ecefPos(3, 0.0), ecefVel(3, 0.0); - for(int i=0; i<3; i++) - { - ecefPos(i) = ecefPosVel(i); - ecefVel(i) = ecefPosVel(i+3); - } - - Vector j2kPos = transpose(c2t) * ecefPos; - Vector j2kVel = transpose(c2t) * ecefVel - +transpose(dc2t)* ecefPos; - - Vector j2kPosVel(6,0.0); - for(int i=0; i<3; i++) - { - j2kPosVel(i) = j2kPos(i); - j2kPosVel(i+3) = j2kVel(i); - } - - return j2kPosVel; - - } // End of method 'ReferenceFrames::ECEFPosVelToJ2k()' - - /// Convert state from J2000 to ECEF. - Vector ReferenceFrames::J2kStateToECEF(UTCTime UTC, Vector j2kState) - throw(Exception) - { - - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - // get Theta rates - double dera1 = earthRotationAngleRate1(UTC.asTT().MJD()); - double dera2 = earthRotationAngleRate2(UTC.asTT().MJD()); - double dera3 = earthRotationAngleRate3(UTC.asTT().MJD()); - - double cs1[3][3]={{0,1,0},{-1,0,0},{0,0,0}}; - double cs2[3][3]={{-1,0,0},{0,-1,0},{0,0,0}}; - double cs3[3][3]={{0,-1,0},{1,0,0},{0,0,0}}; - - Matrix s1(3,3,0.0),s2(3,3,0.0),s3(3,3,0.0); - s1 = &cs1[0][0]; - s2 = &cs2[0][0]; - s3 = &cs3[0][0]; - - // dTheta1 dTheta2 dTheta3 - Matrix dTheta1 = s1 * Theta * dera1; - - Matrix dTheta2 = s2 * Theta * ( dera1 * dera1) - + dTheta1*dera2; - - Matrix dTheta3 = s3 * Theta * ( dera1 * dera1 * dera1) - + s2 * Theta * (2.0 * dera1 * dera2) - + dTheta2 * dera2 - + dTheta1 * dera3; - - Vector r(3,0.0),v(3,0.0),a(3,0.0),d(3,0.0); - for(int i=0; i<3; i++) - { - r(i) = j2kState(i+0); - v(i) = j2kState(i+3); - a(i) = j2kState(i+6); - d(i) = j2kState(i+9); - } - - // tm1 = POM*Theta*NP - Matrix tm1 = POM * Theta * NP; - // tm2 = POM*dTheta1*NP - Matrix tm2 = POM * dTheta1 * NP; - // tm3 = POM*dTheta3*NP - Matrix tm3 = POM * dTheta2 * NP; - // tm4 = POM*dTheta4*NP - Matrix tm4 = POM * dTheta3 * NP; - - Vector r2, v2, a2, d2; - - // r = tm1*r - r2 = tm1 * r; - - // v = tm1*v+tm2*r - v2 = tm1 * v - + tm2 * r; - - // a = tm1*a+2.0*tm2*v+tm3*r - a2 = tm1 * a - + tm2 * v * 2.0 - + tm3 * r; - - // da = tm1*da+3.0*tm2*a+3.0*tm3*v+tm4*r - d2 = tm1 * d - + tm2 * a * 3.0 - + tm3 * v * 3.0 - + tm4 * r; - - Vector state(12,0.0); - for(int i=0; i<3; i++) - { - state(i+0) = r2(i); - state(i+3) = v2(i); - state(i+6) = a2(i); - state(i+9) = d2(i); - } - - return state; - - } // End of method 'ReferenceFrames::J2kStateToECEF()' - - - /// Convert state from ECEF to J2000. - Vector ReferenceFrames::ECEFStateToJ2k(UTCTime UTC, Vector ecefState) - throw(Exception) - { - - Matrix POM, Theta, NP; - J2kToECEFMatrix(UTC,POM,Theta,NP); - - // get Theta rates - double dera1 = earthRotationAngleRate1(UTC.asTT().MJD()); - double dera2 = earthRotationAngleRate2(UTC.asTT().MJD()); - double dera3 = earthRotationAngleRate3(UTC.asTT().MJD()); - - double cs1[3][3]={{0,1,0},{-1,0,0},{0,0,0}}; - double cs2[3][3]={{-1,0,0},{0,-1,0},{0,0,0}}; - double cs3[3][3]={{0,-1,0},{1,0,0},{0,0,0}}; - - Matrix s1(3,3,0.0),s2(3,3,0.0),s3(3,3,0.0); - s1 = &cs1[0][0]; - s2 = &cs2[0][0]; - s3 = &cs3[0][0]; - - // dTheta1 dTheta2 dTheta3 - Matrix dTheta1 = s1 * Theta * dera1; - - Matrix dTheta2 = s2 * Theta * ( dera1 * dera1) - + dTheta1*dera2; - - Matrix dTheta3 = s3 * Theta * ( dera1 * dera1 * dera1) - + s2 * Theta * (2.0 * dera1 * dera2) - + dTheta2 * dera2 - + dTheta1 * dera3; - - Vector r(3,0.0),v(3,0.0),a(3,0.0),d(3,0.0); - for(int i=0; i<3; i++) - { - r(i) = ecefState(i+0); - v(i) = ecefState(i+3); - a(i) = ecefState(i+6); - d(i) = ecefState(i+9); - } - - // tm1 = POM*Theta*NP - Matrix tm1 = transpose( POM * Theta * NP ); - // tm2 = POM*dTheta1*NP - Matrix tm2 = transpose( POM * dTheta1 * NP ); - // tm3 = POM*dTheta3*NP - Matrix tm3 = transpose( POM * dTheta2 * NP ); - // tm4 = POM*dTheta4*NP - Matrix tm4 = transpose( POM * dTheta3 * NP ); - - Vector r2, v2, a2, d2; - - // r = tm1*r - r2 = tm1 * r; - - // v = tm1*v+tm2*r - v2 = tm1 * v - + tm2 * r; - - // a = tm1*a+2.0*tm2*v+tm3*r - a2 = tm1 * a - + tm2 * v * 2.0 - + tm3 * r; - - // da = tm1*da+3.0*tm2*a+3.0*tm3*v+tm4*r - d2 = tm1 * d - + tm2 * a * 3.0 - + tm3 * v * 3.0 - + tm4 * r; - - Vector state(12,0.0); - for(int i=0; i<3; i++) - { - state(i+0) = r2(i); - state(i+3) = v2(i); - state(i+6) = a2(i); - state(i+9) = d2(i); - } - - return state; - - } // End of method 'ReferenceFrames::ECEFStateToJ2k()' - - - // Get earth rotation angle - double ReferenceFrames::earthRotationAngle(CommonTime UT1) - { - // IAU 2000 model - double t = static_cast(UT1).MJD() + (JD_TO_MJD - DJ00); - double f = fmod(double(static_cast(UT1).MJD()),1.0) + fmod(JD_TO_MJD, 1.0); - - double era = normalizeAngle(D2PI*(f+0.7790572732640+0.00273781191135448*t)); - - return era; - } - - /** Earth rotation angle first order rate. - * @param mjdTT Modified Julian Date in TT - * @return d(GAST)/d(t) in [rad] - */ - double ReferenceFrames::earthRotationAngleRate1(const double& mjdTT) - { - const double T = (mjdTT + (JD_TO_MJD - DJ00) )/36525.0; - const double dera = (1.002737909350795 + 5.9006e-11 * T - - 5.9e-15 * T * T ) * D2PI / 86400.0; - - return dera; - } - - - /** Earth rotation angle second order rate . - * @param Modified Julian Date in TT - * @return d(GAST)2/d(t)2 in [rad] - */ - double ReferenceFrames::earthRotationAngleRate2(const double& mjdTT) - { - const double T = ( mjdTT + (JD_TO_MJD - DJ00) ) / 36525.0; - const double dera = (5.9006e-11 - 5.9e-15 * T) * D2PI / 86400.0; - - return dera; - } - - - /** Earth rotation angle third order rate. - * @param Modified Julian Date in TT - * @return d(GAST)3/d(t)3 in [rad] - */ - double ReferenceFrames::earthRotationAngleRate3(const double& mjdTT) - { - //double T = ( mjdTT + (JD_TO_MJD - DJ00) ) / 36525.0; - const double dera = ( -5.9e-15 ) * D2PI / 86400.0; - - return dera; - } - - /** - * COMPUTE DOODSON'S FUNDAMENTAL ARGUMENTS (BETA) - * AND FUNDAMENTAL ARGUMENTS FOR NUTATION (FNUT) - * BETA=(B1,B2,B3,B4,B5,B6) - * FNUT=(F1,F2,F3,F4,F5) - * F1=MEAN ANOMALY (MOON) - * F2=MEAN ANOMALY (SUN) - * F3=F=MOON'S MEAN LONGITUDE-LONGITUDE OF LUNAR ASC. NODE - * F4=D=MEAN ELONGATION OF MOON FROM SUN - * F5=MEAN LONGITUDE OF LUNAR ASC. NODE - * - * B2=S=F3+F5 - * B3=H=S-F4=S-D - * B4=P=S-F1 - * B5=NP=-F5 - * B6=PS=S-F4-F2 - * B1=THETA+PI-S - * - * @param mjdUT1 TIME IN MJD - * @param mjdTT TIME IN TT - * @param THETA CORRESPONDING MEAN SID.TIME GREENWICH - * @param BETA DOODSON ARGUMENTS - * @param FNUT FUNDAMENTAL ARGUMENTS FOR NUTATION - */ - void ReferenceFrames::doodsonArguments(CommonTime UT1, - CommonTime TT, - double BETA[6], - double FNUT[5]) - { - // GMST based IAU2000 - double THETA = iauGmst00(UT1,TT); - - // Fundamental Arguments (from IERS Conventions 2003) - //----------------------------------------------------- - //Julian centuries since J2000 - double t = (static_cast(TT).MJD() + 2400000.5 - 2451545.0) / 36525.0; - - // Mean anomaly of the Moon. - double temp = fmod( 485868.249036 + - t * ( 1717915923.2178 + - t * ( 31.8792 + - t * ( 0.051635 + - t * ( - 0.00024470 ) ) ) ), TURNAS ) * DAS2R; - - double F1 = normalizeAngle(temp); // -pi,pi - - // Mean anomaly of the Sun - temp = fmod( 1287104.793048 + - t * ( 129596581.0481 + - t * ( - 0.5532 + - t * ( 0.000136 + - t * ( - 0.00001149 ) ) ) ), TURNAS ) * DAS2R; - - double F2 = normalizeAngle(temp); // -pi,pi - - // Mean longitude of the Moon minus that of the ascending node. - temp = fmod( 335779.526232 + - t * ( 1739527262.8478 + - t * ( - 12.7512 + - t * ( - 0.001037 + - t * ( 0.00000417 ) ) ) ), TURNAS ) * DAS2R; - double F3 = normalizeAngle(temp); // -pi,pi - - // Mean elongation of the Moon from the Sun. - temp = fmod( 1072260.703692 + - t * ( 1602961601.2090 + - t * ( - 6.3706 + - t * ( 0.006593 + - t * ( - 0.00003169 ) ) ) ), TURNAS ) * DAS2R; - - double F4 = normalizeAngle(temp); // -pi,pi - - // Mean longitude of the ascending node of the Moon. - temp = fmod( 450160.398036 + - t * ( - 6962890.5431 + - t * ( 7.4722 + - t * ( 0.007702 + - t * ( - 0.00005939 ) ) ) ), TURNAS ) * DAS2R; - double F5 = normalizeAngle(temp); // -pi,pi - - FNUT[0] = F1; - FNUT[1] = F2; - FNUT[2] = F3; - FNUT[3] = F4; - FNUT[4] = F5; - - - double S = F3+F5; - - BETA[0] = THETA+ASConstant::PI-S; - BETA[1] = F3+F5; - BETA[2] = S-F4; - BETA[3] = S-F1; - BETA[4] = -F5; - BETA[5] = S-F4-F2; - - } // End of method 'ReferenceFrames::doodsonArguments()' - - - void ReferenceFrames::test() - { - IERS::loadSTKFile("InputData/EOP-v1.1.txt"); - - - double rv_j2k[6]={-23830.593e3,-9747.074e3,-6779.829e3, - +1.561964e3,-1.754346e3,-3.068851e3}; - - Vector j2kPosVel(6,0.0); - Vector ecefPosVel(6,0.0); - - // 2007 07 01 54282 0.192316 0.407299 -0.1582305 - UTCTime utc(2007,07,01,00,0,0.0); - - j2kPosVel = rv_j2k; - ecefPosVel = J2kPosVelToECEF(utc,j2kPosVel); - - for(int i=0;i<6;i++) - cout< fileData; - - std::ifstream fin("de405.txt"); - - std::string path,header,testpo; - - getline(fin,path); - getline(fin,header); - getline(fin,testpo); - - fileHeader = path + header; - - std::string buf; - while(getline(fin,buf)) - { - std::string file = path + buf; - fileData.push_back(file); - } - - fin.close(); - - solarPlanets.readASCIIheader(fileHeader); - cout<= (D2PI*0.5)) - { - w-= ((a<0.0)?-D2PI:D2PI); - } - - return w; - } - - // Rotate an r-matrix about the x-axis. - Matrix ReferenceFrames::Rx(const double& angle) - { - const double s = std::sin(angle); - const double c = std::cos(angle); - - const double a[9] = { 1, 0, 0, 0, c, s, 0,-s, c }; - - Matrix r(3,3,0.0); - r = a; - - return r; - } - - // Rotate an r-matrix about the y-axis. - Matrix ReferenceFrames::Ry(const double& angle) - { - const double s = std::sin(angle); - const double c = std::cos(angle); - - const double a[9] = { c, 0,-s, 0, 1, 0, s, 0, c }; - - Matrix r(3,3,0.0); - r = a; - - return r; - } - - // Rotate an r-matrix about the z-axis. - Matrix ReferenceFrames::Rz(const double& angle) - { - const double s = std::sin(angle); - const double c = std::cos(angle); - - const double a[9] = { c, s, 0,-s, c, 0, 0, 0, 1 }; - - Matrix r(3,3,0.0); - r = a; - - return r; - } - - Matrix ReferenceFrames::iauPmat76(CommonTime TT) - { - - // Interval between fundamental epoch J2000.0 and start epoch (JC). - const double t0 = 0.0; - - // Interval over which precession required (JC). - const double t = (JD_TO_MJD - DJ00 + static_cast(TT).MJD()) / DJC; - - // Euler angles. - const double tas2r = t * DAS2R; - const double w = 2306.2181 + (1.39656 - 0.000139 * t0) * t0; - - double zeta = (w + ((0.30188 - 0.000344 * t0) + 0.017998 * t) * t) * tas2r; - - double z = (w + ((1.09468 + 0.000066 * t0) + 0.018203 * t) * t) * tas2r; - - double theta = ((2004.3109 + (-0.85330 - 0.000217 * t0) * t0) - + ((-0.42665 - 0.000217 * t0) - 0.041833 * t) * t) * tas2r; - - return ( Rz(-z) * Ry(theta) * Rz(-zeta) ); - - } // End of method 'ReferenceFrames::iauPmat76()' - - - void ReferenceFrames::nutationAngles(CommonTime TT, double& dpsi, double& deps) - { - // Units of 0.1 milliarcsecond to radians - const double U2R = DAS2R / 1e4; - - - // Table of multiples of arguments and coefficients - // ------------------------------------------------ - - // The units for the sine and cosine coefficients are 0.1 mas and - // the same per Julian century - - static const struct - { - int nl,nlp,nf,nd,nom; // coefficients of l,l',F,D,Om - double sp,spt; // longitude sine, 1 and t coefficients - double ce,cet; // obliquity cosine, 1 and t coefficients - } x[] = { - - /* 1-10 */ - { 0, 0, 0, 0, 1, -171996.0, -174.2, 92025.0, 8.9 }, - { 0, 0, 0, 0, 2, 2062.0, 0.2, -895.0, 0.5 }, - { -2, 0, 2, 0, 1, 46.0, 0.0, -24.0, 0.0 }, - { 2, 0, -2, 0, 0, 11.0, 0.0, 0.0, 0.0 }, - { -2, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, - { 1, -1, 0, -1, 0, -3.0, 0.0, 0.0, 0.0 }, - { 0, -2, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, - { 2, 0, -2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, - { 0, 0, 2, -2, 2, -13187.0, -1.6, 5736.0, -3.1 }, - { 0, 1, 0, 0, 0, 1426.0, -3.4, 54.0, -0.1 }, - - /* 11-20 */ - { 0, 1, 2, -2, 2, -517.0, 1.2, 224.0, -0.6 }, - { 0, -1, 2, -2, 2, 217.0, -0.5, -95.0, 0.3 }, - { 0, 0, 2, -2, 1, 129.0, 0.1, -70.0, 0.0 }, - { 2, 0, 0, -2, 0, 48.0, 0.0, 1.0, 0.0 }, - { 0, 0, 2, -2, 0, -22.0, 0.0, 0.0, 0.0 }, - { 0, 2, 0, 0, 0, 17.0, -0.1, 0.0, 0.0 }, - { 0, 1, 0, 0, 1, -15.0, 0.0, 9.0, 0.0 }, - { 0, 2, 2, -2, 2, -16.0, 0.1, 7.0, 0.0 }, - { 0, -1, 0, 0, 1, -12.0, 0.0, 6.0, 0.0 }, - { -2, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, - - /* 21-30 */ - { 0, -1, 2, -2, 1, -5.0, 0.0, 3.0, 0.0 }, - { 2, 0, 0, -2, 1, 4.0, 0.0, -2.0, 0.0 }, - { 0, 1, 2, -2, 1, 4.0, 0.0, -2.0, 0.0 }, - { 1, 0, 0, -1, 0, -4.0, 0.0, 0.0, 0.0 }, - { 2, 1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, - { 0, 0, -2, 2, 1, 1.0, 0.0, 0.0, 0.0 }, - { 0, 1, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, - { 0, 1, 0, 0, 2, 1.0, 0.0, 0.0, 0.0 }, - { -1, 0, 0, 1, 1, 1.0, 0.0, 0.0, 0.0 }, - { 0, 1, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, - - /* 31-40 */ - { 0, 0, 2, 0, 2, -2274.0, -0.2, 977.0, -0.5 }, - { 1, 0, 0, 0, 0, 712.0, 0.1, -7.0, 0.0 }, - { 0, 0, 2, 0, 1, -386.0, -0.4, 200.0, 0.0 }, - { 1, 0, 2, 0, 2, -301.0, 0.0, 129.0, -0.1 }, - { 1, 0, 0, -2, 0, -158.0, 0.0, -1.0, 0.0 }, - { -1, 0, 2, 0, 2, 123.0, 0.0, -53.0, 0.0 }, - { 0, 0, 0, 2, 0, 63.0, 0.0, -2.0, 0.0 }, - { 1, 0, 0, 0, 1, 63.0, 0.1, -33.0, 0.0 }, - { -1, 0, 0, 0, 1, -58.0, -0.1, 32.0, 0.0 }, - { -1, 0, 2, 2, 2, -59.0, 0.0, 26.0, 0.0 }, - - /* 41-50 */ - { 1, 0, 2, 0, 1, -51.0, 0.0, 27.0, 0.0 }, - { 0, 0, 2, 2, 2, -38.0, 0.0, 16.0, 0.0 }, - { 2, 0, 0, 0, 0, 29.0, 0.0, -1.0, 0.0 }, - { 1, 0, 2, -2, 2, 29.0, 0.0, -12.0, 0.0 }, - { 2, 0, 2, 0, 2, -31.0, 0.0, 13.0, 0.0 }, - { 0, 0, 2, 0, 0, 26.0, 0.0, -1.0, 0.0 }, - { -1, 0, 2, 0, 1, 21.0, 0.0, -10.0, 0.0 }, - { -1, 0, 0, 2, 1, 16.0, 0.0, -8.0, 0.0 }, - { 1, 0, 0, -2, 1, -13.0, 0.0, 7.0, 0.0 }, - { -1, 0, 2, 2, 1, -10.0, 0.0, 5.0, 0.0 }, - - /* 51-60 */ - { 1, 1, 0, -2, 0, -7.0, 0.0, 0.0, 0.0 }, - { 0, 1, 2, 0, 2, 7.0, 0.0, -3.0, 0.0 }, - { 0, -1, 2, 0, 2, -7.0, 0.0, 3.0, 0.0 }, - { 1, 0, 2, 2, 2, -8.0, 0.0, 3.0, 0.0 }, - { 1, 0, 0, 2, 0, 6.0, 0.0, 0.0, 0.0 }, - { 2, 0, 2, -2, 2, 6.0, 0.0, -3.0, 0.0 }, - { 0, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, - { 0, 0, 2, 2, 1, -7.0, 0.0, 3.0, 0.0 }, - { 1, 0, 2, -2, 1, 6.0, 0.0, -3.0, 0.0 }, - { 0, 0, 0, -2, 1, -5.0, 0.0, 3.0, 0.0 }, - - /* 61-70 */ - { 1, -1, 0, 0, 0, 5.0, 0.0, 0.0, 0.0 }, - { 2, 0, 2, 0, 1, -5.0, 0.0, 3.0, 0.0 }, - { 0, 1, 0, -2, 0, -4.0, 0.0, 0.0, 0.0 }, - { 1, 0, -2, 0, 0, 4.0, 0.0, 0.0, 0.0 }, - { 0, 0, 0, 1, 0, -4.0, 0.0, 0.0, 0.0 }, - { 1, 1, 0, 0, 0, -3.0, 0.0, 0.0, 0.0 }, - { 1, 0, 2, 0, 0, 3.0, 0.0, 0.0, 0.0 }, - { 1, -1, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, - { -1, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, - { -2, 0, 0, 0, 1, -2.0, 0.0, 1.0, 0.0 }, - - /* 71-80 */ - { 3, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, - { 0, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, - { 1, 1, 2, 0, 2, 2.0, 0.0, -1.0, 0.0 }, - { -1, 0, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, - { 2, 0, 0, 0, 1, 2.0, 0.0, -1.0, 0.0 }, - { 1, 0, 0, 0, 2, -2.0, 0.0, 1.0, 0.0 }, - { 3, 0, 0, 0, 0, 2.0, 0.0, 0.0, 0.0 }, - { 0, 0, 2, 1, 2, 2.0, 0.0, -1.0, 0.0 }, - { -1, 0, 0, 0, 2, 1.0, 0.0, -1.0, 0.0 }, - { 1, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, - - /* 81-90 */ - { -2, 0, 2, 2, 2, 1.0, 0.0, -1.0, 0.0 }, - { -1, 0, 2, 4, 2, -2.0, 0.0, 1.0, 0.0 }, - { 2, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, - { 1, 1, 2, -2, 2, 1.0, 0.0, -1.0, 0.0 }, - { 1, 0, 2, 2, 1, -1.0, 0.0, 1.0, 0.0 }, - { -2, 0, 2, 4, 2, -1.0, 0.0, 1.0, 0.0 }, - { -1, 0, 4, 0, 2, 1.0, 0.0, 0.0, 0.0 }, - { 1, -1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, - { 2, 0, 2, -2, 1, 1.0, 0.0, -1.0, 0.0 }, - { 2, 0, 2, 2, 2, -1.0, 0.0, 0.0, 0.0 }, - - /* 91-100 */ - { 1, 0, 0, 2, 1, -1.0, 0.0, 0.0, 0.0 }, - { 0, 0, 4, -2, 2, 1.0, 0.0, 0.0, 0.0 }, - { 3, 0, 2, -2, 2, 1.0, 0.0, 0.0, 0.0 }, - { 1, 0, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, - { 0, 1, 2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, - { -1, -1, 0, 2, 1, 1.0, 0.0, 0.0, 0.0 }, - { 0, 0, -2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, - { 0, 0, 2, -1, 2, -1.0, 0.0, 0.0, 0.0 }, - { 0, 1, 0, 2, 0, -1.0, 0.0, 0.0, 0.0 }, - { 1, 0, -2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, - - /* 101-106 */ - { 0, -1, 2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, - { 1, 1, 0, -2, 1, -1.0, 0.0, 0.0, 0.0 }, - { 1, 0, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, - { 2, 0, 0, 2, 0, 1.0, 0.0, 0.0, 0.0 }, - { 0, 0, 2, 4, 2, -1.0, 0.0, 0.0, 0.0 }, - { 0, 1, 0, 1, 0, 1.0, 0.0, 0.0, 0.0 } - }; - - // Number of terms in the series - const int NT = (int) (sizeof x / sizeof x[0]); - - - // Interval between fundamental epoch J2000.0 and given date (JC). - const double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; - - // Fundamental arguments - // --------------------- - - // Mean longitude of Moon minus mean longitude of Moon's perigee. - double el = normalizeAngle( - (485866.733 + (715922.633 + (31.310 + 0.064 * t) * t) * t) - * DAS2R + fmod(1325.0 * t, 1.0) * D2PI); - - // Mean longitude of Sun minus mean longitude of Sun's perigee. - double elp = normalizeAngle( - (1287099.804 + (1292581.224 + (-0.577 - 0.012 * t) * t) * t) - * DAS2R + fmod(99.0 * t, 1.0) * D2PI); - - // Mean longitude of Moon minus mean longitude of Moon's node. - double f = normalizeAngle( - (335778.877 + (295263.137 + (-13.257 + 0.011 * t) * t) * t) - * DAS2R + fmod(1342.0 * t, 1.0) * D2PI); - - // Mean elongation of Moon from Sun. - double d = normalizeAngle( - (1072261.307 + (1105601.328 + (-6.891 + 0.019 * t) * t) * t) - * DAS2R + fmod(1236.0 * t, 1.0) * D2PI); - - // Longitude of the mean ascending node of the lunar orbit on the - // ecliptic, measured from the mean equinox of date. - double om = normalizeAngle( - (450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t) - * DAS2R + fmod(-5.0 * t, 1.0) * D2PI); - - - // Nutation series - // --------------- - - // Initialize nutation components. - double dp = 0.0; - double de = 0.0; - - // Sum the nutation terms, ending with the biggest. - for (int j = NT-1; j >= 0; j--) - { - - // Form argument for current term. - double arg = (double)x[j].nl * el - + (double)x[j].nlp * elp - + (double)x[j].nf * f - + (double)x[j].nd * d - + (double)x[j].nom * om; - - // Accumulate current nutation term. - double s = x[j].sp + x[j].spt * t; - double c = x[j].ce + x[j].cet * t; - if (s != 0.0) dp += s * std::sin(arg); - if (c != 0.0) de += c * std::cos(arg); - } - - // Convert results from 0.1 mas units to radians. - dpsi = dp * U2R; - deps = de * U2R; - - } // End of 'ReferenceFrames::nutationAngles()' - - - double ReferenceFrames::meanObliquity(CommonTime TT) - { - - // Interval between fundamental epoch J2000.0 and given date (JC) - double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; - - // Mean obliquity of date. - double eps0 = DAS2R * (84381.448 + - (-46.8150 + - (-0.00059 + - ( 0.001813) * t) * t) * t); - - return eps0; - } - - double ReferenceFrames::iauEqeq94(CommonTime TT) - { - // Interval between fundamental epoch J2000.0 and given date (JC). - double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; - - // Longitude of the mean ascending node of the lunar orbit on the - // ecliptic, measured from the mean equinox of date. - double om = normalizeAngle((450160.280 + (-482890.539 - + (7.455 + 0.008 * t) * t) * t) * DAS2R - + fmod(-5.0 * t, 1.0) * D2PI); - - // Nutation components and mean obliquity. - double dpsi(0.0), deps(0.0); - nutationAngles(TT, dpsi, deps); - - double eps0 = meanObliquity(TT); - - // Equation of the equinoxes. - double ee = dpsi * std::cos(eps0) - + DAS2R*(0.00264 * std::sin(om) + 0.000063 * std::sin(om + om)); - - return ee; - } - - double ReferenceFrames::iauGmst82(CommonTime UT1) - { - // Coefficients of IAU 1982 GMST-UT1 model - const double A = 24110.54841 - 86400.0 / 2.0; - const double B = 8640184.812866; - const double C = 0.093104; - const double D = -6.2e-6; - - // Note: the first constant, A, has to be adjusted by 12 hours - // because the UT1 is supplied as a Julian date, which begins - // at noon. - - // Julian centuries since fundamental epoch. - double d2 = JD_TO_MJD; - double d1 = static_cast(UT1).MJD(); - double t = (d1 + (d2 - DJ00)) / DJC; - - // Fractional part of JD(UT1), in seconds. - double f = 86400.0 * (fmod(d1, 1.0) + fmod(d2, 1.0)); - - // GMST at this UT1. - double gmst = normalizeAngle( - DS2R * ((A + (B + (C + D * t) * t) * t) + f)); - - return gmst; - - } // End of method 'ReferenceFrames::iauGmst82()' - - // Greenwich mean sidereal time by IAU 2000 model - double ReferenceFrames::iauGmst00(CommonTime UT1,CommonTime TT) - { - - // TT Julian centuries since J2000.0. - double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; - /* Greenwich Mean Sidereal Time, IAU 2000. */ - double gmst = normalizeAngle(earthRotationAngle(UT1) + - ( 0.014506 + - ( 4612.15739966 + - ( 1.39667721 + - ( -0.00009344 + - ( 0.00001882 ) - * t) * t) * t) * t) * DAS2R); - - return gmst; - - } // End of method 'ReferenceFrames::iauGmst00()' - - // Nutation matrix from nutation angles - Matrix ReferenceFrames::iauNmat(const double& epsa, - const double& dpsi, - const double& deps) - { - return ( Rx(-(epsa+deps)) * Rz(-dpsi) * Rx(epsa) ); - } - - - Matrix ReferenceFrames::enuMatrix(double longitude, double latitude) - { - const double sb = std::sin(latitude); - const double cb = std::cos(latitude); - const double sl = std::sin(longitude); - const double cl = std::cos(longitude); - - double r[3][3]={{-sl,cl,0.0},{-sb*cl,-sb*sl, cb},{ cb*cl,cb*sl,sb}}; - - Matrix enuMat(3,3,0.0); - enuMat = &r[0][0]; - - return enuMat; - - } // End of method 'ReferenceFrames::enuMatrix()' - - // return Azimuth Elevation slant - Vector ReferenceFrames::enuToAzElDt(Vector enu) - { - gpstk::Vector r(3,0.0); - - const double rho = std::sqrt(enu(0)*enu(0)+enu(1)*enu(1)); - - // Angles - double A = std::atan2(enu(0),enu(1)); - A = (A<0.0)? (A+ASConstant::TWO_PI) : A; - double E = std::atan ( enu(2) / rho ); - - r(0) = A; - r(1) = E; - r(2) = norm(enu); - - return r; - } - - - void ReferenceFrames::XYZ2BLH(double xyz[3],double blh[3]) - { - const double f = ASConstant::f_Earth; //sqrt(0.00669437999013); - const double R_equ = ASConstant::R_Earth; //Equator radius [m] - const double e2 = f*(2.0-f); // Square of eccentricity - - const double eps = 1.0e3*std::numeric_limits::epsilon();; // Convergence criterion - const double epsRequ = eps*R_equ; - - - const double X = xyz[0]; // Cartesian coordinates - const double Y = xyz[1]; - const double Z = xyz[2]; - const double rho2 = X*X + Y*Y; // Square of distance from z-axis - const double rho = std::sqrt(rho2+Z*Z); - - // Check validity of input data - if (rho==0.0) - { - blh[0] = 0.0; - blh[1] = 0.0; - blh[2] = -R_equ; - return; - } - - // Iteration - double dZ, dZ_new, SinPhi; - double ZdZ, Nh, N; - - dZ = e2*Z; - while(1) - { - ZdZ = Z + dZ; - Nh = std::sqrt ( rho2 + ZdZ*ZdZ ); - SinPhi = ZdZ / Nh; // Sine of geodetic latitude - N = R_equ / std::sqrt(1.0-e2*SinPhi*SinPhi); - dZ_new = N*e2*SinPhi; - if ( std::fabs(dZ-dZ_new) < epsRequ ) break; - dZ = dZ_new; - } - - // latitude, Longitude, altitude - blh[0] = std::atan2 ( ZdZ, std::sqrt(rho2) ); - blh[1] = std::atan2 ( Y, X ); - blh[2] = Nh - N; - - } // End of method 'ReferenceFrames::XYZ2BLH()' - - void ReferenceFrames::BLH2XYZ(double blh[3],double xyz[3]) - { - const double f = ASConstant::f_Earth; //sqrt(0.00669437999013); - const double a = ASConstant::R_Earth; //Equator radius [m] - const double e2 = f*(2.0-f); // Square of eccentricity - - double N=a/(std::sqrt(1-e2*std::sin(blh[0])*std::sin(blh[0]))); - xyz[0]=(N+blh[2])*std::cos(blh[0])*std::cos(blh[1]); - xyz[1]=(N+blh[2])*std::cos(blh[0])*std::sin(blh[1]); - xyz[2]=(N*(1-e2)+blh[2])*std::sin(blh[0]); - - } // End of method 'ReferenceFrames::BLH2XYZ()' - - - void ReferenceFrames::XYZ2ENU(double blh[3],double xyz[3],double enu[3]) - { - double xyz0[3]={0.0}; - BLH2XYZ(blh,xyz0); - - double dxyz[3]={0.0}; - dxyz[0] = xyz[0]-xyz0[0]; - dxyz[1] = xyz[1]-xyz0[1]; - dxyz[2] = xyz[2]-xyz0[2]; - - const double sb = std::sin(blh[0]); - const double cb = std::cos(blh[0]); - const double sl = std::sin(blh[1]); - const double cl = std::cos(blh[1]); - - double r[3][3]={{-sl,cl,0.0},{-sb*cl,-sb*sl, cb},{ cb*cl,cb*sl,sb}}; - - enu[0] = r[0][0] * dxyz[0] + r[0][1] * dxyz[1] + r[0][2] * dxyz[2]; - enu[1] = r[1][0] * dxyz[0] + r[1][1] * dxyz[1] + r[1][2] * dxyz[2]; - enu[2] = r[2][0] * dxyz[0] + r[2][1] * dxyz[1] + r[2][2] * dxyz[2]; - - } // End of method 'ReferenceFrames::XYZ2ENU()' - - -} // End of namespace 'gsptk' +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// Wei Yan - Chinese Academy of Sciences . 2009, 2010 +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/** + * @file ReferenceFrames.cpp + * Class to do Reference frame transformation. + */ + +#include "ReferenceFrames.hpp" +#include +#include +#include +#include +#include "StringUtils.hpp" +#include "IERS.hpp" +#include "ASConstant.hpp" + + +namespace gpstk +{ + using namespace std; + + // Objects to handle JPL ephemeris 405 + SolarSystem ReferenceFrames::solarPlanets; + + // Reference epoch (J2000), Julian Date + const double ReferenceFrames::DJ00 = 2451545.0; + + // Conversion offset, Julian Date to Modified Julian Date. + const double ReferenceFrames::JD_TO_MJD = 2400000.5; + + // 2PI + const double ReferenceFrames::D2PI = 6.283185307179586476925287; + + // Days per Julian century + const double ReferenceFrames::DJC = 36525.0; + + // Arcseconds to radians + const double ReferenceFrames::DAS2R = 4.848136811095359935899141e-6; + + // seconds to radians + const double ReferenceFrames::DS2R = 7.272205216643039903848712e-5; + + // Arcseconds in a full circle + const double ReferenceFrames::TURNAS = 1296000.0; + + + /* Compute planet position in J2000 + * + * @param TT Time(Modified Julian Date in TT) of interest + * @param entity The planet to be computed + * @return The position of the planet in km + */ + Vector ReferenceFrames::getJ2kPosition( const CommonTime& TT, + SolarSystem::Planet entity) + throw(Exception) + { + Vector rvJ2k = getJ2kPosVel(TT,entity); + + Vector rJ2k(3,0.0); + for(int i=0; i<3; i++) + { + rJ2k[i] = rvJ2k[i]; + } + + return rJ2k; + } + + /* Compute planet velocity in J2000 + * + * @param TT Time(Modified Julian Date in TT) of interest + * @param entity The planet to be computed + * @return The velocity of the planet in km + */ + Vector ReferenceFrames::getJ2kVelocity( const CommonTime& TT, + SolarSystem::Planet entity) + throw(Exception) + { + Vector rvJ2k = getJ2kPosVel(TT,entity); + + Vector vJ2k(3,0.0); + for(int i = 0; i < 3; i++) + { + vJ2k[i] = rvJ2k[i+3]; + } + + return vJ2k; + } + + /* Compute planet position and velocity + * + * @param TT Time(Modified Julian Date in TT) of interest + * @param entity The planet to be computed + * @param center relative to whick the result apply + * @return The position and velocity of the planet in km and km/s + */ + Vector ReferenceFrames::getJ2kPosVel( const CommonTime& TT, + SolarSystem::Planet entity, + SolarSystem::Planet center) + throw(Exception) + { + Vector rvJ2k(6,0.0); + + try + { + double rvState[6] = {0.0}; + int ret = solarPlanets.computeState(JD_TO_MJD + static_cast(TT).MJD(), + entity, + center, + rvState); + + // change the unit to km/s from km/day + rvState[3] /= 86400.0; + rvState[4] /= 86400.0; + rvState[5] /= 86400.0; + + if(ret == 0) + { + rvJ2k = rvState; + return rvJ2k; + } + else + { + rvJ2k.resize(6,0.0); + + // failed to compute + InvalidRequest e("Failed to compute, error code: " + +StringUtils::asString(ret)+" with meaning\n" + +"-1 and -2 given time is out of the file \n" + +"-3 and -4 input stream is not open or not valid," + +" or EOF was found prematurely"); + + GPSTK_THROW(e); + } + } + catch(Exception& e) + { + GPSTK_RETHROW(e); + } + catch(std::exception& e) + { + Exception ee(e.what()); + GPSTK_THROW(ee); + } + catch(...) + { + Exception e("Unknown error!"); + GPSTK_THROW(e); + } + + return rvJ2k; + + } // End of method 'ReferenceFrames::getJ2kPosVel()' + + + /* Compute planet position in ECEF + * + * @param UTC Time(Modified Julian Date in UTC) of interest + * @param entity The planet to be computed + * @param center relative to whick the result apply + * @return The position of the planet in km and km/s + */ + Vector ReferenceFrames::getECEFPosition(UTCTime UTC, + SolarSystem::Planet entity, + SolarSystem::Planet center) + throw(Exception) + { + Vector ecefPosVel = getECEFPosVel(UTC, entity, center); + + Vector ecefPos(3,0.0); + ecefPos(0) = ecefPosVel(0); + ecefPos(1) = ecefPosVel(1); + ecefPos(2) = ecefPosVel(2); + + return ecefPos; + } + + /* Compute planet velocity in ECEF + * + * @param UTC Time(Modified Julian Date in UTC) of interest + * @param entity The planet to be computed + * @param center relative to whick the result apply + * @return The position of the planet in km and km/s + */ + Vector ReferenceFrames::getECEFVelocity(UTCTime UTC, + SolarSystem::Planet entity, + SolarSystem::Planet center) + throw(Exception) + { + Vector ecefPosVel = getECEFPosVel(UTC, entity, center); + + Vector ecefVel(3,0.0); + ecefVel(0) = ecefPosVel(3); + ecefVel(1) = ecefPosVel(4); + ecefVel(2) = ecefPosVel(5); + + return ecefVel; + } + + /* Compute planet position and velocity in ECEF + * + * @param UTC Time(Modified Julian Date in UTC) of interest + * @param entity The planet to be computed + * @param center relative to whick the result apply + * @return The position and velocity of the planet in km and km/s + */ + Vector ReferenceFrames::getECEFPosVel( UTCTime UTC, + SolarSystem::Planet entity, + SolarSystem::Planet center) + throw(Exception) + { + Vector j2kPosVel = getJ2kPosVel( UTC.asTT(), entity, center); + Vector ecefPosVel = J2kPosVelToECEF(UTC, j2kPosVel); + + return ecefPosVel; + } + + // ECEF = W * S * NP * J2k + void ReferenceFrames::J2kToECEFMatrix(UTCTime UTC, + Matrix& POM, + Matrix& Theta, + Matrix& NP) + throw(Exception) + { + // Earth orientation data + double xp = UTC.xPole() * DAS2R; + double yp = UTC.yPole() * DAS2R; + + CommonTime TT = UTC.asTT(); + CommonTime UT1 = UTC.asUT1(); + + + // IAU 1976 precession matrix + Matrix P = iauPmat76(TT); + + // Nutation correction wrt IAU 1976/1980 (mas->radians) + const double DDP80 = 0.0; //-55.0655 * DAS2R/1000.0; + const double DDE80 = 0.0; //-6.3580 * DAS2R/1000.0; + + // Nutation angle + double DPSI = 0.0; + double DEPS = 0.0; + nutationAngles(TT, DPSI, DEPS); + + DPSI += DDP80; + DEPS += DDE80; + + // Mean obliquity + double EPSA = meanObliquity(TT); + + // IAU 1980 Nutation matrix + Matrix N = iauNmat(EPSA, DPSI , DEPS); + + // NP + NP = N * P; + + // Euqation of the equinoxes, including nutation correction + double EE = iauEqeq94(TT) + DDP80 * std::cos(EPSA); + + // Greenwich apparent sidereal time(IAU 1982/1994) + double GST = normalizeAngle(iauGmst82(UT1) + EE); + + Theta = Rz(GST); + + // Polar motion matrix + POM = Ry(-xp) * Rx(-yp); + + // All Matrix are ready now + + return; + + } // End of method 'ReferenceFrames::J2kToECEFMatrix()' + + + // return POM * Theta * NP + Matrix ReferenceFrames::J2kToECEFMatrix(UTCTime UTC) + { + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + return (POM * Theta * NP); + } + + /// NP TOD - TrueOfDate + Matrix ReferenceFrames::J2kToTODMatrix(UTCTime UTC) + { + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + return NP; + } + + + Vector ReferenceFrames::J2kPosVelToECEF(UTCTime UTC, Vector j2kPosVel) + throw(Exception) + { + + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + const double dera = earthRotationAngleRate1(UTC.mjdTT()); + + // Derivative of Earth rotation + Matrix S(3,3,0.0); + S(0,1) = 1.0; S(1,0) = -1.0; + + Matrix dTheta = dera * S * Theta; + + Matrix c2t = POM * Theta * NP; + Matrix dc2t = POM * dTheta * NP; + + Vector j2kPos(3, 0.0), j2kVel(3, 0.0); + for(int i=0; i<3; i++) + { + j2kPos(i) = j2kPosVel(i); + j2kVel(i) = j2kPosVel(i+3); + } + + Vector ecefPos = c2t * j2kPos; + Vector ecefVel = c2t * j2kVel + dc2t * j2kPos; + + Vector ecefPosVel(6,0.0); + for(int i=0; i<3; i++) + { + ecefPosVel(i) = ecefPos(i); + ecefPosVel(i+3) = ecefVel(i); + } + + return ecefPosVel; + + } // End of method 'ReferenceFrames::J2kPosVelToECEF()' + + + Vector ReferenceFrames::ECEFPosVelToJ2k(UTCTime UTC, Vector ecefPosVel) + throw(Exception) + { + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + const double dera = earthRotationAngleRate1(UTC.mjdTT()); + + // Derivative of Earth rotation + Matrix S(3,3,0.0); + S(0,1) = 1.0; S(1,0) = -1.0; + + Matrix dTheta = dera * S * Theta; + + Matrix c2t = POM * Theta * NP; + Matrix dc2t = POM * dTheta * NP; + + Vector ecefPos(3, 0.0), ecefVel(3, 0.0); + for(int i=0; i<3; i++) + { + ecefPos(i) = ecefPosVel(i); + ecefVel(i) = ecefPosVel(i+3); + } + + Vector j2kPos = transpose(c2t) * ecefPos; + Vector j2kVel = transpose(c2t) * ecefVel + +transpose(dc2t)* ecefPos; + + Vector j2kPosVel(6,0.0); + for(int i=0; i<3; i++) + { + j2kPosVel(i) = j2kPos(i); + j2kPosVel(i+3) = j2kVel(i); + } + + return j2kPosVel; + + } // End of method 'ReferenceFrames::ECEFPosVelToJ2k()' + + /// Convert state from J2000 to ECEF. + Vector ReferenceFrames::J2kStateToECEF(UTCTime UTC, Vector j2kState) + throw(Exception) + { + + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + // get Theta rates + double dera1 = earthRotationAngleRate1(UTC.asTT().MJD()); + double dera2 = earthRotationAngleRate2(UTC.asTT().MJD()); + double dera3 = earthRotationAngleRate3(UTC.asTT().MJD()); + + double cs1[3][3]={{0,1,0},{-1,0,0},{0,0,0}}; + double cs2[3][3]={{-1,0,0},{0,-1,0},{0,0,0}}; + double cs3[3][3]={{0,-1,0},{1,0,0},{0,0,0}}; + + Matrix s1(3,3,0.0),s2(3,3,0.0),s3(3,3,0.0); + s1 = &cs1[0][0]; + s2 = &cs2[0][0]; + s3 = &cs3[0][0]; + + // dTheta1 dTheta2 dTheta3 + Matrix dTheta1 = s1 * Theta * dera1; + + Matrix dTheta2 = s2 * Theta * ( dera1 * dera1) + + dTheta1*dera2; + + Matrix dTheta3 = s3 * Theta * ( dera1 * dera1 * dera1) + + s2 * Theta * (2.0 * dera1 * dera2) + + dTheta2 * dera2 + + dTheta1 * dera3; + + Vector r(3,0.0),v(3,0.0),a(3,0.0),d(3,0.0); + for(int i=0; i<3; i++) + { + r(i) = j2kState(i+0); + v(i) = j2kState(i+3); + a(i) = j2kState(i+6); + d(i) = j2kState(i+9); + } + + // tm1 = POM*Theta*NP + Matrix tm1 = POM * Theta * NP; + // tm2 = POM*dTheta1*NP + Matrix tm2 = POM * dTheta1 * NP; + // tm3 = POM*dTheta3*NP + Matrix tm3 = POM * dTheta2 * NP; + // tm4 = POM*dTheta4*NP + Matrix tm4 = POM * dTheta3 * NP; + + Vector r2, v2, a2, d2; + + // r = tm1*r + r2 = tm1 * r; + + // v = tm1*v+tm2*r + v2 = tm1 * v + + tm2 * r; + + // a = tm1*a+2.0*tm2*v+tm3*r + a2 = tm1 * a + + tm2 * v * 2.0 + + tm3 * r; + + // da = tm1*da+3.0*tm2*a+3.0*tm3*v+tm4*r + d2 = tm1 * d + + tm2 * a * 3.0 + + tm3 * v * 3.0 + + tm4 * r; + + Vector state(12,0.0); + for(int i=0; i<3; i++) + { + state(i+0) = r2(i); + state(i+3) = v2(i); + state(i+6) = a2(i); + state(i+9) = d2(i); + } + + return state; + + } // End of method 'ReferenceFrames::J2kStateToECEF()' + + + /// Convert state from ECEF to J2000. + Vector ReferenceFrames::ECEFStateToJ2k(UTCTime UTC, Vector ecefState) + throw(Exception) + { + + Matrix POM, Theta, NP; + J2kToECEFMatrix(UTC,POM,Theta,NP); + + // get Theta rates + double dera1 = earthRotationAngleRate1(UTC.asTT().MJD()); + double dera2 = earthRotationAngleRate2(UTC.asTT().MJD()); + double dera3 = earthRotationAngleRate3(UTC.asTT().MJD()); + + double cs1[3][3]={{0,1,0},{-1,0,0},{0,0,0}}; + double cs2[3][3]={{-1,0,0},{0,-1,0},{0,0,0}}; + double cs3[3][3]={{0,-1,0},{1,0,0},{0,0,0}}; + + Matrix s1(3,3,0.0),s2(3,3,0.0),s3(3,3,0.0); + s1 = &cs1[0][0]; + s2 = &cs2[0][0]; + s3 = &cs3[0][0]; + + // dTheta1 dTheta2 dTheta3 + Matrix dTheta1 = s1 * Theta * dera1; + + Matrix dTheta2 = s2 * Theta * ( dera1 * dera1) + + dTheta1*dera2; + + Matrix dTheta3 = s3 * Theta * ( dera1 * dera1 * dera1) + + s2 * Theta * (2.0 * dera1 * dera2) + + dTheta2 * dera2 + + dTheta1 * dera3; + + Vector r(3,0.0),v(3,0.0),a(3,0.0),d(3,0.0); + for(int i=0; i<3; i++) + { + r(i) = ecefState(i+0); + v(i) = ecefState(i+3); + a(i) = ecefState(i+6); + d(i) = ecefState(i+9); + } + + // tm1 = POM*Theta*NP + Matrix tm1 = transpose( POM * Theta * NP ); + // tm2 = POM*dTheta1*NP + Matrix tm2 = transpose( POM * dTheta1 * NP ); + // tm3 = POM*dTheta3*NP + Matrix tm3 = transpose( POM * dTheta2 * NP ); + // tm4 = POM*dTheta4*NP + Matrix tm4 = transpose( POM * dTheta3 * NP ); + + Vector r2, v2, a2, d2; + + // r = tm1*r + r2 = tm1 * r; + + // v = tm1*v+tm2*r + v2 = tm1 * v + + tm2 * r; + + // a = tm1*a+2.0*tm2*v+tm3*r + a2 = tm1 * a + + tm2 * v * 2.0 + + tm3 * r; + + // da = tm1*da+3.0*tm2*a+3.0*tm3*v+tm4*r + d2 = tm1 * d + + tm2 * a * 3.0 + + tm3 * v * 3.0 + + tm4 * r; + + Vector state(12,0.0); + for(int i=0; i<3; i++) + { + state(i+0) = r2(i); + state(i+3) = v2(i); + state(i+6) = a2(i); + state(i+9) = d2(i); + } + + return state; + + } // End of method 'ReferenceFrames::ECEFStateToJ2k()' + + + // Get earth rotation angle + double ReferenceFrames::earthRotationAngle(CommonTime UT1) + { + // IAU 2000 model + double t = static_cast(UT1).MJD() + (JD_TO_MJD - DJ00); + double f = fmod(double(static_cast(UT1).MJD()),1.0) + fmod(JD_TO_MJD, 1.0); + + double era = normalizeAngle(D2PI*(f+0.7790572732640+0.00273781191135448*t)); + + return era; + } + + /** Earth rotation angle first order rate. + * @param mjdTT Modified Julian Date in TT + * @return d(GAST)/d(t) in [rad] + */ + double ReferenceFrames::earthRotationAngleRate1(const double& mjdTT) + { + const double T = (mjdTT + (JD_TO_MJD - DJ00) )/36525.0; + const double dera = (1.002737909350795 + 5.9006e-11 * T + - 5.9e-15 * T * T ) * D2PI / 86400.0; + + return dera; + } + + + /** Earth rotation angle second order rate . + * @param Modified Julian Date in TT + * @return d(GAST)2/d(t)2 in [rad] + */ + double ReferenceFrames::earthRotationAngleRate2(const double& mjdTT) + { + const double T = ( mjdTT + (JD_TO_MJD - DJ00) ) / 36525.0; + const double dera = (5.9006e-11 - 5.9e-15 * T) * D2PI / 86400.0; + + return dera; + } + + + /** Earth rotation angle third order rate. + * @param Modified Julian Date in TT + * @return d(GAST)3/d(t)3 in [rad] + */ + double ReferenceFrames::earthRotationAngleRate3(const double& mjdTT) + { + //double T = ( mjdTT + (JD_TO_MJD - DJ00) ) / 36525.0; + const double dera = ( -5.9e-15 ) * D2PI / 86400.0; + + return dera; + } + + /** + * COMPUTE DOODSON'S FUNDAMENTAL ARGUMENTS (BETA) + * AND FUNDAMENTAL ARGUMENTS FOR NUTATION (FNUT) + * BETA=(B1,B2,B3,B4,B5,B6) + * FNUT=(F1,F2,F3,F4,F5) + * F1=MEAN ANOMALY (MOON) + * F2=MEAN ANOMALY (SUN) + * F3=F=MOON'S MEAN LONGITUDE-LONGITUDE OF LUNAR ASC. NODE + * F4=D=MEAN ELONGATION OF MOON FROM SUN + * F5=MEAN LONGITUDE OF LUNAR ASC. NODE + * + * B2=S=F3+F5 + * B3=H=S-F4=S-D + * B4=P=S-F1 + * B5=NP=-F5 + * B6=PS=S-F4-F2 + * B1=THETA+PI-S + * + * @param mjdUT1 TIME IN MJD + * @param mjdTT TIME IN TT + * @param THETA CORRESPONDING MEAN SID.TIME GREENWICH + * @param BETA DOODSON ARGUMENTS + * @param FNUT FUNDAMENTAL ARGUMENTS FOR NUTATION + */ + void ReferenceFrames::doodsonArguments(CommonTime UT1, + CommonTime TT, + double BETA[6], + double FNUT[5]) + { + // GMST based IAU2000 + double THETA = iauGmst00(UT1,TT); + + // Fundamental Arguments (from IERS Conventions 2003) + //----------------------------------------------------- + //Julian centuries since J2000 + double t = (static_cast(TT).MJD() + 2400000.5 - 2451545.0) / 36525.0; + + // Mean anomaly of the Moon. + double temp = fmod( 485868.249036 + + t * ( 1717915923.2178 + + t * ( 31.8792 + + t * ( 0.051635 + + t * ( - 0.00024470 ) ) ) ), TURNAS ) * DAS2R; + + double F1 = normalizeAngle(temp); // -pi,pi + + // Mean anomaly of the Sun + temp = fmod( 1287104.793048 + + t * ( 129596581.0481 + + t * ( - 0.5532 + + t * ( 0.000136 + + t * ( - 0.00001149 ) ) ) ), TURNAS ) * DAS2R; + + double F2 = normalizeAngle(temp); // -pi,pi + + // Mean longitude of the Moon minus that of the ascending node. + temp = fmod( 335779.526232 + + t * ( 1739527262.8478 + + t * ( - 12.7512 + + t * ( - 0.001037 + + t * ( 0.00000417 ) ) ) ), TURNAS ) * DAS2R; + double F3 = normalizeAngle(temp); // -pi,pi + + // Mean elongation of the Moon from the Sun. + temp = fmod( 1072260.703692 + + t * ( 1602961601.2090 + + t * ( - 6.3706 + + t * ( 0.006593 + + t * ( - 0.00003169 ) ) ) ), TURNAS ) * DAS2R; + + double F4 = normalizeAngle(temp); // -pi,pi + + // Mean longitude of the ascending node of the Moon. + temp = fmod( 450160.398036 + + t * ( - 6962890.5431 + + t * ( 7.4722 + + t * ( 0.007702 + + t * ( - 0.00005939 ) ) ) ), TURNAS ) * DAS2R; + double F5 = normalizeAngle(temp); // -pi,pi + + FNUT[0] = F1; + FNUT[1] = F2; + FNUT[2] = F3; + FNUT[3] = F4; + FNUT[4] = F5; + + + double S = F3+F5; + + BETA[0] = THETA+ASConstant::PI-S; + BETA[1] = F3+F5; + BETA[2] = S-F4; + BETA[3] = S-F1; + BETA[4] = -F5; + BETA[5] = S-F4-F2; + + } // End of method 'ReferenceFrames::doodsonArguments()' + + + void ReferenceFrames::test() + { + IERS::loadSTKFile("InputData/EOP-v1.1.txt"); + + + double rv_j2k[6]={-23830.593e3,-9747.074e3,-6779.829e3, + +1.561964e3,-1.754346e3,-3.068851e3}; + + Vector j2kPosVel(6,0.0); + Vector ecefPosVel(6,0.0); + + // 2007 07 01 54282 0.192316 0.407299 -0.1582305 + UTCTime utc(2007,07,01,00,0,0.0); + + j2kPosVel = rv_j2k; + ecefPosVel = J2kPosVelToECEF(utc,j2kPosVel); + + for(int i=0;i<6;i++) + cout< fileData; + + std::ifstream fin("de405.txt"); + + std::string path,header,testpo; + + getline(fin,path); + getline(fin,header); + getline(fin,testpo); + + fileHeader = path + header; + + std::string buf; + while(getline(fin,buf)) + { + std::string file = path + buf; + fileData.push_back(file); + } + + fin.close(); + + solarPlanets.readASCIIheader(fileHeader); + cout<= (D2PI*0.5)) + { + w-= ((a<0.0)?-D2PI:D2PI); + } + + return w; + } + + // Rotate an r-matrix about the x-axis. + Matrix ReferenceFrames::Rx(const double& angle) + { + const double s = std::sin(angle); + const double c = std::cos(angle); + + const double a[9] = { 1, 0, 0, 0, c, s, 0,-s, c }; + + Matrix r(3,3,0.0); + r = a; + + return r; + } + + // Rotate an r-matrix about the y-axis. + Matrix ReferenceFrames::Ry(const double& angle) + { + const double s = std::sin(angle); + const double c = std::cos(angle); + + const double a[9] = { c, 0,-s, 0, 1, 0, s, 0, c }; + + Matrix r(3,3,0.0); + r = a; + + return r; + } + + // Rotate an r-matrix about the z-axis. + Matrix ReferenceFrames::Rz(const double& angle) + { + const double s = std::sin(angle); + const double c = std::cos(angle); + + const double a[9] = { c, s, 0,-s, c, 0, 0, 0, 1 }; + + Matrix r(3,3,0.0); + r = a; + + return r; + } + + Matrix ReferenceFrames::iauPmat76(CommonTime TT) + { + + // Interval between fundamental epoch J2000.0 and start epoch (JC). + const double t0 = 0.0; + + // Interval over which precession required (JC). + const double t = (JD_TO_MJD - DJ00 + static_cast(TT).MJD()) / DJC; + + // Euler angles. + const double tas2r = t * DAS2R; + const double w = 2306.2181 + (1.39656 - 0.000139 * t0) * t0; + + double zeta = (w + ((0.30188 - 0.000344 * t0) + 0.017998 * t) * t) * tas2r; + + double z = (w + ((1.09468 + 0.000066 * t0) + 0.018203 * t) * t) * tas2r; + + double theta = ((2004.3109 + (-0.85330 - 0.000217 * t0) * t0) + + ((-0.42665 - 0.000217 * t0) - 0.041833 * t) * t) * tas2r; + + return ( Rz(-z) * Ry(theta) * Rz(-zeta) ); + + } // End of method 'ReferenceFrames::iauPmat76()' + + + void ReferenceFrames::nutationAngles(CommonTime TT, double& dpsi, double& deps) + { + // Units of 0.1 milliarcsecond to radians + const double U2R = DAS2R / 1e4; + + + // Table of multiples of arguments and coefficients + // ------------------------------------------------ + + // The units for the sine and cosine coefficients are 0.1 mas and + // the same per Julian century + + static const struct + { + int nl,nlp,nf,nd,nom; // coefficients of l,l',F,D,Om + double sp,spt; // longitude sine, 1 and t coefficients + double ce,cet; // obliquity cosine, 1 and t coefficients + } x[] = { + + /* 1-10 */ + { 0, 0, 0, 0, 1, -171996.0, -174.2, 92025.0, 8.9 }, + { 0, 0, 0, 0, 2, 2062.0, 0.2, -895.0, 0.5 }, + { -2, 0, 2, 0, 1, 46.0, 0.0, -24.0, 0.0 }, + { 2, 0, -2, 0, 0, 11.0, 0.0, 0.0, 0.0 }, + { -2, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, + { 1, -1, 0, -1, 0, -3.0, 0.0, 0.0, 0.0 }, + { 0, -2, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, + { 2, 0, -2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, + { 0, 0, 2, -2, 2, -13187.0, -1.6, 5736.0, -3.1 }, + { 0, 1, 0, 0, 0, 1426.0, -3.4, 54.0, -0.1 }, + + /* 11-20 */ + { 0, 1, 2, -2, 2, -517.0, 1.2, 224.0, -0.6 }, + { 0, -1, 2, -2, 2, 217.0, -0.5, -95.0, 0.3 }, + { 0, 0, 2, -2, 1, 129.0, 0.1, -70.0, 0.0 }, + { 2, 0, 0, -2, 0, 48.0, 0.0, 1.0, 0.0 }, + { 0, 0, 2, -2, 0, -22.0, 0.0, 0.0, 0.0 }, + { 0, 2, 0, 0, 0, 17.0, -0.1, 0.0, 0.0 }, + { 0, 1, 0, 0, 1, -15.0, 0.0, 9.0, 0.0 }, + { 0, 2, 2, -2, 2, -16.0, 0.1, 7.0, 0.0 }, + { 0, -1, 0, 0, 1, -12.0, 0.0, 6.0, 0.0 }, + { -2, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, + + /* 21-30 */ + { 0, -1, 2, -2, 1, -5.0, 0.0, 3.0, 0.0 }, + { 2, 0, 0, -2, 1, 4.0, 0.0, -2.0, 0.0 }, + { 0, 1, 2, -2, 1, 4.0, 0.0, -2.0, 0.0 }, + { 1, 0, 0, -1, 0, -4.0, 0.0, 0.0, 0.0 }, + { 2, 1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, + { 0, 0, -2, 2, 1, 1.0, 0.0, 0.0, 0.0 }, + { 0, 1, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, + { 0, 1, 0, 0, 2, 1.0, 0.0, 0.0, 0.0 }, + { -1, 0, 0, 1, 1, 1.0, 0.0, 0.0, 0.0 }, + { 0, 1, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, + + /* 31-40 */ + { 0, 0, 2, 0, 2, -2274.0, -0.2, 977.0, -0.5 }, + { 1, 0, 0, 0, 0, 712.0, 0.1, -7.0, 0.0 }, + { 0, 0, 2, 0, 1, -386.0, -0.4, 200.0, 0.0 }, + { 1, 0, 2, 0, 2, -301.0, 0.0, 129.0, -0.1 }, + { 1, 0, 0, -2, 0, -158.0, 0.0, -1.0, 0.0 }, + { -1, 0, 2, 0, 2, 123.0, 0.0, -53.0, 0.0 }, + { 0, 0, 0, 2, 0, 63.0, 0.0, -2.0, 0.0 }, + { 1, 0, 0, 0, 1, 63.0, 0.1, -33.0, 0.0 }, + { -1, 0, 0, 0, 1, -58.0, -0.1, 32.0, 0.0 }, + { -1, 0, 2, 2, 2, -59.0, 0.0, 26.0, 0.0 }, + + /* 41-50 */ + { 1, 0, 2, 0, 1, -51.0, 0.0, 27.0, 0.0 }, + { 0, 0, 2, 2, 2, -38.0, 0.0, 16.0, 0.0 }, + { 2, 0, 0, 0, 0, 29.0, 0.0, -1.0, 0.0 }, + { 1, 0, 2, -2, 2, 29.0, 0.0, -12.0, 0.0 }, + { 2, 0, 2, 0, 2, -31.0, 0.0, 13.0, 0.0 }, + { 0, 0, 2, 0, 0, 26.0, 0.0, -1.0, 0.0 }, + { -1, 0, 2, 0, 1, 21.0, 0.0, -10.0, 0.0 }, + { -1, 0, 0, 2, 1, 16.0, 0.0, -8.0, 0.0 }, + { 1, 0, 0, -2, 1, -13.0, 0.0, 7.0, 0.0 }, + { -1, 0, 2, 2, 1, -10.0, 0.0, 5.0, 0.0 }, + + /* 51-60 */ + { 1, 1, 0, -2, 0, -7.0, 0.0, 0.0, 0.0 }, + { 0, 1, 2, 0, 2, 7.0, 0.0, -3.0, 0.0 }, + { 0, -1, 2, 0, 2, -7.0, 0.0, 3.0, 0.0 }, + { 1, 0, 2, 2, 2, -8.0, 0.0, 3.0, 0.0 }, + { 1, 0, 0, 2, 0, 6.0, 0.0, 0.0, 0.0 }, + { 2, 0, 2, -2, 2, 6.0, 0.0, -3.0, 0.0 }, + { 0, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, + { 0, 0, 2, 2, 1, -7.0, 0.0, 3.0, 0.0 }, + { 1, 0, 2, -2, 1, 6.0, 0.0, -3.0, 0.0 }, + { 0, 0, 0, -2, 1, -5.0, 0.0, 3.0, 0.0 }, + + /* 61-70 */ + { 1, -1, 0, 0, 0, 5.0, 0.0, 0.0, 0.0 }, + { 2, 0, 2, 0, 1, -5.0, 0.0, 3.0, 0.0 }, + { 0, 1, 0, -2, 0, -4.0, 0.0, 0.0, 0.0 }, + { 1, 0, -2, 0, 0, 4.0, 0.0, 0.0, 0.0 }, + { 0, 0, 0, 1, 0, -4.0, 0.0, 0.0, 0.0 }, + { 1, 1, 0, 0, 0, -3.0, 0.0, 0.0, 0.0 }, + { 1, 0, 2, 0, 0, 3.0, 0.0, 0.0, 0.0 }, + { 1, -1, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, + { -1, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, + { -2, 0, 0, 0, 1, -2.0, 0.0, 1.0, 0.0 }, + + /* 71-80 */ + { 3, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, + { 0, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, + { 1, 1, 2, 0, 2, 2.0, 0.0, -1.0, 0.0 }, + { -1, 0, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, + { 2, 0, 0, 0, 1, 2.0, 0.0, -1.0, 0.0 }, + { 1, 0, 0, 0, 2, -2.0, 0.0, 1.0, 0.0 }, + { 3, 0, 0, 0, 0, 2.0, 0.0, 0.0, 0.0 }, + { 0, 0, 2, 1, 2, 2.0, 0.0, -1.0, 0.0 }, + { -1, 0, 0, 0, 2, 1.0, 0.0, -1.0, 0.0 }, + { 1, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, + + /* 81-90 */ + { -2, 0, 2, 2, 2, 1.0, 0.0, -1.0, 0.0 }, + { -1, 0, 2, 4, 2, -2.0, 0.0, 1.0, 0.0 }, + { 2, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, + { 1, 1, 2, -2, 2, 1.0, 0.0, -1.0, 0.0 }, + { 1, 0, 2, 2, 1, -1.0, 0.0, 1.0, 0.0 }, + { -2, 0, 2, 4, 2, -1.0, 0.0, 1.0, 0.0 }, + { -1, 0, 4, 0, 2, 1.0, 0.0, 0.0, 0.0 }, + { 1, -1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, + { 2, 0, 2, -2, 1, 1.0, 0.0, -1.0, 0.0 }, + { 2, 0, 2, 2, 2, -1.0, 0.0, 0.0, 0.0 }, + + /* 91-100 */ + { 1, 0, 0, 2, 1, -1.0, 0.0, 0.0, 0.0 }, + { 0, 0, 4, -2, 2, 1.0, 0.0, 0.0, 0.0 }, + { 3, 0, 2, -2, 2, 1.0, 0.0, 0.0, 0.0 }, + { 1, 0, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, + { 0, 1, 2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, + { -1, -1, 0, 2, 1, 1.0, 0.0, 0.0, 0.0 }, + { 0, 0, -2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, + { 0, 0, 2, -1, 2, -1.0, 0.0, 0.0, 0.0 }, + { 0, 1, 0, 2, 0, -1.0, 0.0, 0.0, 0.0 }, + { 1, 0, -2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, + + /* 101-106 */ + { 0, -1, 2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, + { 1, 1, 0, -2, 1, -1.0, 0.0, 0.0, 0.0 }, + { 1, 0, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, + { 2, 0, 0, 2, 0, 1.0, 0.0, 0.0, 0.0 }, + { 0, 0, 2, 4, 2, -1.0, 0.0, 0.0, 0.0 }, + { 0, 1, 0, 1, 0, 1.0, 0.0, 0.0, 0.0 } + }; + + // Number of terms in the series + const int NT = (int) (sizeof x / sizeof x[0]); + + + // Interval between fundamental epoch J2000.0 and given date (JC). + const double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; + + // Fundamental arguments + // --------------------- + + // Mean longitude of Moon minus mean longitude of Moon's perigee. + double el = normalizeAngle( + (485866.733 + (715922.633 + (31.310 + 0.064 * t) * t) * t) + * DAS2R + fmod(1325.0 * t, 1.0) * D2PI); + + // Mean longitude of Sun minus mean longitude of Sun's perigee. + double elp = normalizeAngle( + (1287099.804 + (1292581.224 + (-0.577 - 0.012 * t) * t) * t) + * DAS2R + fmod(99.0 * t, 1.0) * D2PI); + + // Mean longitude of Moon minus mean longitude of Moon's node. + double f = normalizeAngle( + (335778.877 + (295263.137 + (-13.257 + 0.011 * t) * t) * t) + * DAS2R + fmod(1342.0 * t, 1.0) * D2PI); + + // Mean elongation of Moon from Sun. + double d = normalizeAngle( + (1072261.307 + (1105601.328 + (-6.891 + 0.019 * t) * t) * t) + * DAS2R + fmod(1236.0 * t, 1.0) * D2PI); + + // Longitude of the mean ascending node of the lunar orbit on the + // ecliptic, measured from the mean equinox of date. + double om = normalizeAngle( + (450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t) + * DAS2R + fmod(-5.0 * t, 1.0) * D2PI); + + + // Nutation series + // --------------- + + // Initialize nutation components. + double dp = 0.0; + double de = 0.0; + + // Sum the nutation terms, ending with the biggest. + for (int j = NT-1; j >= 0; j--) + { + + // Form argument for current term. + double arg = (double)x[j].nl * el + + (double)x[j].nlp * elp + + (double)x[j].nf * f + + (double)x[j].nd * d + + (double)x[j].nom * om; + + // Accumulate current nutation term. + double s = x[j].sp + x[j].spt * t; + double c = x[j].ce + x[j].cet * t; + if (s != 0.0) dp += s * std::sin(arg); + if (c != 0.0) de += c * std::cos(arg); + } + + // Convert results from 0.1 mas units to radians. + dpsi = dp * U2R; + deps = de * U2R; + + } // End of 'ReferenceFrames::nutationAngles()' + + + double ReferenceFrames::meanObliquity(CommonTime TT) + { + + // Interval between fundamental epoch J2000.0 and given date (JC) + double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; + + // Mean obliquity of date. + double eps0 = DAS2R * (84381.448 + + (-46.8150 + + (-0.00059 + + ( 0.001813) * t) * t) * t); + + return eps0; + } + + double ReferenceFrames::iauEqeq94(CommonTime TT) + { + // Interval between fundamental epoch J2000.0 and given date (JC). + double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; + + // Longitude of the mean ascending node of the lunar orbit on the + // ecliptic, measured from the mean equinox of date. + double om = normalizeAngle((450160.280 + (-482890.539 + + (7.455 + 0.008 * t) * t) * t) * DAS2R + + fmod(-5.0 * t, 1.0) * D2PI); + + // Nutation components and mean obliquity. + double dpsi(0.0), deps(0.0); + nutationAngles(TT, dpsi, deps); + + double eps0 = meanObliquity(TT); + + // Equation of the equinoxes. + double ee = dpsi * std::cos(eps0) + + DAS2R*(0.00264 * std::sin(om) + 0.000063 * std::sin(om + om)); + + return ee; + } + + double ReferenceFrames::iauGmst82(CommonTime UT1) + { + // Coefficients of IAU 1982 GMST-UT1 model + const double A = 24110.54841 - 86400.0 / 2.0; + const double B = 8640184.812866; + const double C = 0.093104; + const double D = -6.2e-6; + + // Note: the first constant, A, has to be adjusted by 12 hours + // because the UT1 is supplied as a Julian date, which begins + // at noon. + + // Julian centuries since fundamental epoch. + double d2 = JD_TO_MJD; + double d1 = static_cast(UT1).MJD(); + double t = (d1 + (d2 - DJ00)) / DJC; + + // Fractional part of JD(UT1), in seconds. + double f = 86400.0 * (fmod(d1, 1.0) + fmod(d2, 1.0)); + + // GMST at this UT1. + double gmst = normalizeAngle( + DS2R * ((A + (B + (C + D * t) * t) * t) + f)); + + return gmst; + + } // End of method 'ReferenceFrames::iauGmst82()' + + // Greenwich mean sidereal time by IAU 2000 model + double ReferenceFrames::iauGmst00(CommonTime UT1,CommonTime TT) + { + + // TT Julian centuries since J2000.0. + double t = ((JD_TO_MJD - DJ00) + static_cast(TT).MJD()) / DJC; + /* Greenwich Mean Sidereal Time, IAU 2000. */ + double gmst = normalizeAngle(earthRotationAngle(UT1) + + ( 0.014506 + + ( 4612.15739966 + + ( 1.39667721 + + ( -0.00009344 + + ( 0.00001882 ) + * t) * t) * t) * t) * DAS2R); + + return gmst; + + } // End of method 'ReferenceFrames::iauGmst00()' + + // Nutation matrix from nutation angles + Matrix ReferenceFrames::iauNmat(const double& epsa, + const double& dpsi, + const double& deps) + { + return ( Rx(-(epsa+deps)) * Rz(-dpsi) * Rx(epsa) ); + } + + + Matrix ReferenceFrames::enuMatrix(double longitude, double latitude) + { + const double sb = std::sin(latitude); + const double cb = std::cos(latitude); + const double sl = std::sin(longitude); + const double cl = std::cos(longitude); + + double r[3][3]={{-sl,cl,0.0},{-sb*cl,-sb*sl, cb},{ cb*cl,cb*sl,sb}}; + + Matrix enuMat(3,3,0.0); + enuMat = &r[0][0]; + + return enuMat; + + } // End of method 'ReferenceFrames::enuMatrix()' + + // return Azimuth Elevation slant + Vector ReferenceFrames::enuToAzElDt(Vector enu) + { + gpstk::Vector r(3,0.0); + + const double rho = std::sqrt(enu(0)*enu(0)+enu(1)*enu(1)); + + // Angles + double A = std::atan2(enu(0),enu(1)); + A = (A<0.0)? (A+ASConstant::TWO_PI) : A; + double E = std::atan ( enu(2) / rho ); + + r(0) = A; + r(1) = E; + r(2) = norm(enu); + + return r; + } + + + void ReferenceFrames::XYZ2BLH(double xyz[3],double blh[3]) + { + const double f = ASConstant::f_Earth; //sqrt(0.00669437999013); + const double R_equ = ASConstant::R_Earth; //Equator radius [m] + const double e2 = f*(2.0-f); // Square of eccentricity + + const double eps = 1.0e3*std::numeric_limits::epsilon();; // Convergence criterion + const double epsRequ = eps*R_equ; + + + const double X = xyz[0]; // Cartesian coordinates + const double Y = xyz[1]; + const double Z = xyz[2]; + const double rho2 = X*X + Y*Y; // Square of distance from z-axis + const double rho = std::sqrt(rho2+Z*Z); + + // Check validity of input data + if (rho==0.0) + { + blh[0] = 0.0; + blh[1] = 0.0; + blh[2] = -R_equ; + return; + } + + // Iteration + double dZ, dZ_new, SinPhi; + double ZdZ, Nh, N; + + dZ = e2*Z; + while(1) + { + ZdZ = Z + dZ; + Nh = std::sqrt ( rho2 + ZdZ*ZdZ ); + SinPhi = ZdZ / Nh; // Sine of geodetic latitude + N = R_equ / std::sqrt(1.0-e2*SinPhi*SinPhi); + dZ_new = N*e2*SinPhi; + if ( std::fabs(dZ-dZ_new) < epsRequ ) break; + dZ = dZ_new; + } + + // latitude, Longitude, altitude + blh[0] = std::atan2 ( ZdZ, std::sqrt(rho2) ); + blh[1] = std::atan2 ( Y, X ); + blh[2] = Nh - N; + + } // End of method 'ReferenceFrames::XYZ2BLH()' + + void ReferenceFrames::BLH2XYZ(double blh[3],double xyz[3]) + { + const double f = ASConstant::f_Earth; //sqrt(0.00669437999013); + const double a = ASConstant::R_Earth; //Equator radius [m] + const double e2 = f*(2.0-f); // Square of eccentricity + + double N=a/(std::sqrt(1-e2*std::sin(blh[0])*std::sin(blh[0]))); + xyz[0]=(N+blh[2])*std::cos(blh[0])*std::cos(blh[1]); + xyz[1]=(N+blh[2])*std::cos(blh[0])*std::sin(blh[1]); + xyz[2]=(N*(1-e2)+blh[2])*std::sin(blh[0]); + + } // End of method 'ReferenceFrames::BLH2XYZ()' + + + void ReferenceFrames::XYZ2ENU(double blh[3],double xyz[3],double enu[3]) + { + double xyz0[3]={0.0}; + BLH2XYZ(blh,xyz0); + + double dxyz[3]={0.0}; + dxyz[0] = xyz[0]-xyz0[0]; + dxyz[1] = xyz[1]-xyz0[1]; + dxyz[2] = xyz[2]-xyz0[2]; + + const double sb = std::sin(blh[0]); + const double cb = std::cos(blh[0]); + const double sl = std::sin(blh[1]); + const double cl = std::cos(blh[1]); + + double r[3][3]={{-sl,cl,0.0},{-sb*cl,-sb*sl, cb},{ cb*cl,cb*sl,sb}}; + + enu[0] = r[0][0] * dxyz[0] + r[0][1] * dxyz[1] + r[0][2] * dxyz[2]; + enu[1] = r[1][0] * dxyz[0] + r[1][1] * dxyz[1] + r[1][2] * dxyz[2]; + enu[2] = r[2][0] * dxyz[0] + r[2][1] * dxyz[1] + r[2][2] * dxyz[2]; + + } // End of method 'ReferenceFrames::XYZ2ENU()' + + +} // End of namespace 'gsptk' diff --git a/ext/lib/Geomatics/AntexData.cpp b/ext/lib/Geomatics/AntexData.cpp index 7990a98cb..bcf6b098b 100644 --- a/ext/lib/Geomatics/AntexData.cpp +++ b/ext/lib/Geomatics/AntexData.cpp @@ -441,7 +441,7 @@ namespace gpstk } void AntexData::reallyPutRecord(FFStream& ffs) const - throw(exception, FFStreamError, StringException) + throw(std::exception, FFStreamError, StringException) { if(!isValid()) { FFStreamError fse(string("Cannot write invalid AntexData")); @@ -633,7 +633,7 @@ namespace gpstk void AntexData::reallyGetRecord(FFStream& ffs) - throw(exception, FFStreamError, StringUtils::StringException) + throw(std::exception, FFStreamError, StringUtils::StringException) { AntexStream& strm = dynamic_cast(ffs); @@ -891,7 +891,7 @@ namespace gpstk return time; } // string exceptions for substr are caught here - catch (exception &e) + catch (std::exception &e) { FFStreamError err("std::exception: " + string(e.what())); GPSTK_THROW(err); diff --git a/ext/lib/Geomatics/DiscCorr.cpp b/ext/lib/Geomatics/DiscCorr.cpp index 4c84019cb..fcbe89a62 100644 --- a/ext/lib/Geomatics/DiscCorr.cpp +++ b/ext/lib/Geomatics/DiscCorr.cpp @@ -98,7 +98,7 @@ try { setParameter(label, asDouble(value)); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -118,7 +118,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -161,7 +161,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -236,7 +236,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -690,7 +690,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -857,7 +857,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -910,7 +910,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -980,7 +980,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1090,7 +1090,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1145,7 +1145,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1171,7 +1171,7 @@ try { deleteSegment(it,"insufficient data in segment"); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1325,7 +1325,7 @@ try { } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1420,7 +1420,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1514,7 +1514,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1625,7 +1625,7 @@ try { return isSlip; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1706,7 +1706,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1769,7 +1769,7 @@ try { return; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1852,7 +1852,7 @@ try { return; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2000,7 +2000,7 @@ try { return; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2134,7 +2134,7 @@ try { return nadj; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2199,7 +2199,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2278,7 +2278,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2366,7 +2366,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2488,7 +2488,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2539,7 +2539,7 @@ try { return isOut; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2715,7 +2715,7 @@ try { return isSlip; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -2804,7 +2804,7 @@ try { return ReturnOK; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -3092,7 +3092,7 @@ try { return retMessage; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -3134,7 +3134,7 @@ try { return SegList.insert(++sit,s); // insert puts s before ++sit } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -3228,7 +3228,7 @@ try { return msg; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -3256,7 +3256,7 @@ try { learn["segments deleted: " + msg]++; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/lib/Geomatics/Namelist.cpp b/ext/lib/Geomatics/Namelist.cpp index 6122a0a28..b8a4b0fa7 100644 --- a/ext/lib/Geomatics/Namelist.cpp +++ b/ext/lib/Geomatics/Namelist.cpp @@ -92,11 +92,12 @@ try { catch(Exception& e) { GPSTK_RETHROW(e); } } -// add a name to the Namelist; do nothing if the name is not unique. +// add a name to the Namelist; throw if the name is not unique. Namelist& Namelist::operator+=(const string& name) { try { - if(this->contains(name)) return *this; + if(this->contains(name)) + GPSTK_THROW(Exception("Name is not unique: " + name)); labels.push_back(name); return *this; } @@ -371,7 +372,7 @@ try { catch(Exception& e) { GPSTK_RETHROW(e); } } -ostream& operator<<(ostream& os, const LabeledVector& nlp) +ostream& operator<<(ostream& os, const LabeledVector& LV) { try { size_t i; @@ -381,34 +382,34 @@ try { //int wid=os.width(),prec=os.precision(); // print message or blanks - os << nlp.tag << " "; - if(nlp.msg.size() > 0) - s = nlp.msg + " "; + os << LV.tag << " "; + if(LV.msg.size() > 0) + s = LV.msg + " "; else - s = rightJustify(string(""),nlp.msg.size()); //nlp.wid); + s = rightJustify(string(""),LV.msg.size()); //LV.wid); os << s << " "; // print each label - for(i=0; i nlp.wid) - s = leftJustify(nlp.NL.getName(i),nlp.wid); + for(i=0; i LV.wid) + s = leftJustify(LV.NL.getName(i),LV.wid); else - s = rightJustify(nlp.NL.getName(i),nlp.wid); + s = rightJustify(LV.NL.getName(i),LV.wid); os << s; - if(i-nlp.NL.size()+1) os << " "; + if(i-LV.NL.size()+1) os << " "; } os << endl; // next line // print same space as with labels - s = rightJustify(string(""),nlp.msg.size()); //nlp.wid); - os << nlp.tag << " " << s << " "; - if(nlp.form == 1) os << fixed; - if(nlp.form == 2) os << scientific; - for(i=0; i 0) // msg - s = nlp.msg + " "; + if(LM.rc == 0) { // only if printing both column and row labels + os << LM.tag << " "; // tag + if(LM.msg.size() > 0) // msg + s = LM.msg; // + " "; else - s = rightJustify(string(""),nlp.wid); + s = rightJustify(string(" "),LM.wid); os << s << " "; - if(int(nlp.msg.size()) > 0 && int(nlp.msg.size()) < nlp.wid) - os << rightJustify(string(""),nlp.wid-nlp.msg.size()); // space + if(int(LM.msg.size()) > 0 && int(LM.msg.size()) < LM.wid) + os << rightJustify(string(" "),LM.wid-LM.msg.size()); // space } // print column labels - if(nlp.rc != 1) { // but not if 'rows only' - n = (nlp.M.cols() < pNLcol->size() ? nlp.M.cols() : pNLcol->size()); + if(LM.rc != 1) { // but not if 'rows only' + n = (LM.M.cols() < pNLcol->size() ? LM.M.cols() : pNLcol->size()); for(i=0; igetName(i).size()) > nlp.wid) - s = leftJustify(pNLcol->getName(i),nlp.wid); + if(int(pNLcol->getName(i).size()) > LM.wid) + s = leftJustify(pNLcol->getName(i),LM.wid); else - s = rightJustify(pNLcol->getName(i),nlp.wid); + s = rightJustify(pNLcol->getName(i),LM.wid); os << s; // label if(i-n+1) os << " "; } os << endl; } - if(nlp.form == 1) os << fixed; - if(nlp.form == 2) os << scientific; - if(int(nlp.msg.size()) > nlp.wid) nspace = nlp.msg.size()-nlp.wid; + if(LM.form == 1) os << fixed; + if(LM.form == 2) os << scientific; + if(int(LM.msg.size()) > LM.wid) nspace = LM.msg.size()-LM.wid+2; else nspace = 0; // print one row per line - for(i=0; igetName(i).size()) > nlp.wid) - s = leftJustify(pNLrow->getName(i),nlp.wid); + if(LM.rc != 2) { // but not if 'columns only' + if(int(pNLrow->getName(i).size()) > LM.wid) + s = leftJustify(pNLrow->getName(i),LM.wid); else - s = rightJustify(pNLrow->getName(i),nlp.wid); + s = rightJustify(pNLrow->getName(i),LM.wid); os << s << " "; // label } // finally, print the data - for(j=0; j& M; LabeledMatrix(const Namelist& nl, const Matrix& m) - : wid(12), prec(5), form(1), rc(0), NLrows(nl), NLcols(nl), M(m) { } - LabeledMatrix(const Namelist& nlr, const Namelist& nlc, const Matrix& m) - : wid(12), prec(5), form(1), rc(0), NLrows(nlr), NLcols(nlc), M(m) { } + : sym(false), cln(false), wid(12), prec(5), form(1), rc(0), + M(m), NLrows(nl), NLcols(nl) { } + LabeledMatrix(const Namelist& nr, const Namelist& nc, const Matrix& m) + : sym(false), cln(false), wid(12), prec(5), form(1), rc(0), + M(m), NLrows(nr), NLcols(nc) { } LabeledMatrix& setw(int w) { wid = w; return *this; } LabeledMatrix& setprecision(int p) { prec = p; return *this; } LabeledMatrix& fixed(void) { form = 1; return *this; } LabeledMatrix& scientific(void) { form = 2; return *this; } + LabeledMatrix& symmetric(bool s) { sym = s; return *this; } + LabeledMatrix& clean(bool s) { cln = s; return *this; } LabeledMatrix& both(void) { rc=0; return *this; } LabeledMatrix& rows(void) { rc=1; return *this; } LabeledMatrix& cols(void) { rc=2; return *this; } @@ -104,8 +110,8 @@ class LabeledMatrix { LabeledMatrix& linetag(const std::string& m) { tag=m; return *this; } }; -std::ostream& operator<<(std::ostream&, const LabeledMatrix&); -std::ostream& operator<<(std::ostream&, const LabeledVector&); +std::ostream& operator<<(std::ostream& os, const LabeledMatrix& lm); +std::ostream& operator<<(std::ostream& os, const LabeledVector& lv); //------------------------------------------------------------------------------------ @@ -136,7 +142,8 @@ class Namelist { /// operator= Namelist& operator=(const Namelist& right) { labels = right.labels; return *this; } - /// add a single name to the Namelist; do nothing if the name is not unique. + /// add a single name to the Namelist + /// @throw if the name is not unique Namelist& operator+=(const std::string&); /// remove a name from the Namelist; does nothing if the name is not found. Namelist& operator-=(const std::string&); diff --git a/ext/lib/Geomatics/PhaseWindup.cpp b/ext/lib/Geomatics/PhaseWindup.cpp index a48af8d91..e70e60d6b 100644 --- a/ext/lib/Geomatics/PhaseWindup.cpp +++ b/ext/lib/Geomatics/PhaseWindup.cpp @@ -116,7 +116,7 @@ try { return windup; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -174,7 +174,7 @@ try { return windup; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/lib/Geomatics/RobustStats.cpp b/ext/lib/Geomatics/RobustStats.cpp index 3af5dd463..f0564b614 100644 --- a/ext/lib/Geomatics/RobustStats.cpp +++ b/ext/lib/Geomatics/RobustStats.cpp @@ -118,11 +118,11 @@ void Robust::StemLeafPlot(ostream& os, double *xd, long nd, string msg) } // find length of stem for printing - buf = asString(::abs(Stem(xd[0],scale))); + buf = asString(std::abs(Stem(xd[0],scale))); len = buf.size(); - buf = asString(::abs(Stem(xd[nd-1],scale))); + buf = asString(std::abs(Stem(xd[nd-1],scale))); if(len < buf.size()) len=buf.size(); - buf = asString(::abs(Stem(M,scale))); + buf = asString(std::abs(Stem(M,scale))); if(len < buf.size()) len=buf.size(); // loop through data, adding stems and leaves to plot @@ -385,7 +385,7 @@ int Robust::RobustPolyFit(double *xd, const double *td, int nd, return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } @@ -445,7 +445,7 @@ double gpstk::ADtest(double *xd, const int nd, return AD; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } diff --git a/ext/lib/Geomatics/SRI.cpp b/ext/lib/Geomatics/SRI.cpp index ceb2dd4a5..0a1e7b672 100644 --- a/ext/lib/Geomatics/SRI.cpp +++ b/ext/lib/Geomatics/SRI.cpp @@ -66,6 +66,7 @@ using namespace StringUtils; // -------------------------------------------------------------------------------- // used to mark optional input const Matrix SRINullMatrix; + const SparseMatrix SRINullSparseMatrix; //--------------------------------------------------------------------------------- // constructor given the dimension N. @@ -364,7 +365,7 @@ using namespace StringUtils; } // append to names at the end, and to R Z, zero filling - const int I(names.size()); + const size_t I(names.size()); *this += S.names; // just in case...to avoid overflow in loop below @@ -495,7 +496,7 @@ using namespace StringUtils; // Zero out all the first n rows of R and elements of Z, removing all // information about those elements. Default value of the input is 0, // meaning zero out the entire SRI. - void SRI::zeroAll(const int n) + void SRI::zeroAll(const unsigned int n) throw() { if(n <= 0) { @@ -507,7 +508,7 @@ using namespace StringUtils; if(n >= int(R.rows())) return; - for(int i=0; i InvCov = inverse(Cov); + Matrix InvCov = inverseLUD(Cov); addAPrioriInformation(InvCov, X); } catch(MatrixException& me) { @@ -865,9 +866,8 @@ using namespace StringUtils; } try { - Cholesky Ch; - Ch(InvCov); - Matrix apR(transpose(Ch.L)); // R = UT(inv(Cov)) + Matrix L(lowerCholesky(InvCov)); + Matrix apR(transpose(L)); // R = UT(inv(Cov)) Vector apZ(apR*X); // Z = R*X SrifMU(R, Z, apR, apZ); } @@ -935,21 +935,22 @@ using namespace StringUtils; try { double small,big; Matrix invR(inverseUT(R,&small,&big)); + if(ptrSmall) *ptrSmall = small; + if(ptrBig) *ptrBig = big; + //cout << " small is " << scientific << setprecision(3) << small - // << " and exponent is " << ::log(big) - ::log(small) << endl; + // << " and big is " << big; + //cout << " exponent is " << ::log(big) - ::log(small) << endl; // how best to test? // ::log(big) - ::log(small) + 1 >= numeric_limits::max_exponent - if(small <= 10*numeric_limits::epsilon()) - { + if(small <= 10*numeric_limits::epsilon()) { MatrixException me("Singular matrix: condition number is " + asString(big) + " / " + asString(small)); GPSTK_THROW(me); } + C = UTtimesTranspose(invR); X = invR * Z; - - if(ptrSmall) *ptrSmall = small; - if(ptrBig) *ptrBig = big; } catch(MatrixException& me) { GPSTK_RETHROW(me); diff --git a/ext/lib/Geomatics/SRI.hpp b/ext/lib/Geomatics/SRI.hpp index ec8b16918..d40be7d26 100644 --- a/ext/lib/Geomatics/SRI.hpp +++ b/ext/lib/Geomatics/SRI.hpp @@ -61,6 +61,7 @@ // geomatics #include "Namelist.hpp" #include "SRIMatrix.hpp" +#include "SparseMatrix.hpp" namespace gpstk { @@ -68,6 +69,8 @@ namespace gpstk //------------------------------------------------------------------------------------ /// constant (empty) Matrix used for default input arguments extern const Matrix SRINullMatrix; +/// constant (empty) SparseMatrix used for default input arguments +extern const SparseMatrix SRINullSparseMatrix; //------------------------------------------------------------------------------------ /// class SRI encapsulates all the information associated with the solution of a set @@ -245,7 +248,7 @@ class SRI { /// Zero out all the first n rows of R and elements of Z, removing all /// information about those elements. Default value of the input is 0, /// meaning zero out the entire SRI. - void zeroAll(const int n=0) + void zeroAll(const unsigned int n=0) throw(); /// Zero out (set all elements to zero) the state (Vector Z) only. @@ -332,10 +335,26 @@ class SRI { /// SRIF (Kalman) measurement update, or least squares update /// Call the SRI measurement update for this SRI and the given input. See doc. /// for SrifMU(). - void measurementUpdate(Matrix& Partials, - Vector& Data) - throw(MatrixException) - { SrifMU(R, Z, Partials, Data); } + void measurementUpdate(Matrix& Partials, Vector& Data) + throw(Exception) + { + try { + SrifMU(R, Z, Partials, Data); + } + catch(Exception& me) { GPSTK_RETHROW(me); } + } + + /// SRIF (Kalman) measurement update, or least squares update, Sparse version. + /// Call the SRI measurement update for this SRI and the given input. See doc. + /// for SrifMU(). + void measurementUpdate(SparseMatrix& Partials, Vector& Data) + throw(Exception) + { + try { + SrifMU(R, Z, Partials, Data); + } + catch(MatrixException& me) { GPSTK_RETHROW(me); } + } /// Compute the condition number, or rather the largest and smallest eigenvalues /// of the SRI matrix R (the condition number is the ratio of the largest and diff --git a/ext/lib/Geomatics/SRIFilter.cpp b/ext/lib/Geomatics/SRIFilter.cpp index 97b21e105..c4c808b36 100644 --- a/ext/lib/Geomatics/SRIFilter.cpp +++ b/ext/lib/Geomatics/SRIFilter.cpp @@ -1,3 +1,10 @@ +/// @file SRIFilter.cpp Implementation of class SRIFilter. +/// class SRIFilter implements the square root information matrix form of the +/// Kalman filter. +/// +/// Reference: "Factorization Methods for Discrete Sequential Estimation," +/// G.J. Bierman, Academic Press, 1977. + //============================================================================ // // This file is part of GPSTk, the GPS Toolkit. @@ -34,16 +41,6 @@ // //============================================================================= -/** - * @file SRIFilter.cpp - * Implementation of class SRIFilter. - * class SRIFilter implements the square root information matrix form of the - * Kalman filter. - * - * Reference: "Factorization Methods for Discrete Sequential Estimation," - * G.J. Bierman, Academic Press, 1977. - */ - //------------------------------------------------------------------------------------ #include "SRIFilter.hpp" #include "RobustStats.hpp" @@ -127,15 +124,14 @@ SRIFilter& SRIFilter::operator=(const SRIFilter& right) //------------------------------------------------------------------------------------ // SRIF (Kalman) measurement update, or least squares update -// Returns (whitened) residuals in D -void SRIFilter::measurementUpdate(const Matrix& H, - Vector& D, +// Returns unwhitened residuals in D +void SRIFilter::measurementUpdate(const Matrix& H, Vector& D, const Matrix& CM) throw(MatrixException,VectorException) { if(H.cols() != R.cols() || H.rows() != D.size() || - (&CM != &SRINullMatrix && (CM.rows() != D.size() || CM.cols() != D.size())) ) { - + (&CM != &SRINullMatrix && (CM.rows() != D.size() || CM.cols() != D.size())) ) + { string msg("\nInvalid input dimensions:\n SRI is "); msg += asString(R.rows()) + "x" + asString(R.cols()) + ",\n Partials is " @@ -150,14 +146,11 @@ void SRIFilter::measurementUpdate(const Matrix& H, GPSTK_THROW(me); } try { - Matrix P(H); - Cholesky Ch; - // whiten partials and data + Matrix P(H); + Matrix CHL(lowerCholesky(CM)); if(&CM != &SRINullMatrix) { - Matrix L; - Ch(CM); - L = inverse(Ch.L); + Matrix L(inverseLT(CHL)); P = L * P; D = L * D; } @@ -166,8 +159,55 @@ void SRIFilter::measurementUpdate(const Matrix& H, SrifMU(R, Z, P, D); // un-whiten residuals - if(&CM != &SRINullMatrix) { - D = Ch.L * D; + if(&CM != &SRINullMatrix) { // same if above creates CHL + D = CHL * D; + } + } + catch(MatrixException& me) { GPSTK_RETHROW(me); } + catch(VectorException& ve) { GPSTK_RETHROW(ve); } +} + +//------------------------------------------------------------------------------------ +// SRIF (Kalman) measurement update, or least squares update -- SparseMatrix version +// Returns unwhitened residuals in D +void SRIFilter::measurementUpdate(const SparseMatrix& H, Vector& D, + const SparseMatrix& CM) + throw(MatrixException,VectorException) +{ + if(H.cols() != R.cols() || H.rows() != D.size() || + (&CM != &SRINullSparseMatrix && + (CM.rows() != D.size() || CM.cols() != D.size())) ) + { + string msg("\nInvalid input dimensions:\n SRI is "); + msg += asString(R.rows()) + "x" + + asString(R.cols()) + ",\n Partials is " + + asString(H.rows()) + "x" + + asString(H.cols()) + ",\n Data has length " + + asString(D.size()); + if(&CM != &SRINullSparseMatrix) msg += ",\n and Cov is " + + asString(CM.rows()) + "x" + + asString(CM.cols()); + + MatrixException me(msg); + GPSTK_THROW(me); + } + try { + SparseMatrix A(H || D); + SparseMatrix CHL; + // whiten partials and data + if(&CM != &SRINullSparseMatrix) { + CHL = lowerCholesky(CM); + SparseMatrix L(inverseLT(CHL)); + A = L * A; + } + + // update *this with the whitened information + SrifMU(R, Z, A); + + // copy out D and un-whiten residuals + D = Vector(A.colCopy(A.cols()-1)); + if(&CM != &SRINullSparseMatrix) { // same if above creates CHL + D = CHL * D; } } catch(MatrixException& me) { GPSTK_RETHROW(me); } @@ -817,7 +857,7 @@ void SRIFilter::SrifSU_DM(Matrix& P, } try { - G = G * inverse(Rw); + G = G * inverseLUD(Rw); Matrix F; F = ident(N) + G*Rwx; // update X @@ -872,7 +912,7 @@ void DMsmootherUpdateWithControl(Matrix& P, } try { - G = G * inverse(Rw); + G = G * inverseLUD(Rw); Matrix F; F = ident(N) + G*Rwx; // update X diff --git a/ext/lib/Geomatics/SRIFilter.hpp b/ext/lib/Geomatics/SRIFilter.hpp index 7f030be52..6cbf07b73 100644 --- a/ext/lib/Geomatics/SRIFilter.hpp +++ b/ext/lib/Geomatics/SRIFilter.hpp @@ -54,7 +54,9 @@ // GPSTk #include "Vector.hpp" #include "Matrix.hpp" +// geomatics #include "SRI.hpp" +#include "SparseMatrix.hpp" namespace gpstk { @@ -130,9 +132,19 @@ class SRIFilter : public SRI { /// @param CM Measurement covariance matrix, dimension MxM. /// @throw if dimension N does not match dimension of SRI, or if other /// dimensions are inconsistent, or if CM is singular. - void measurementUpdate(const Matrix& H, - Vector& D, - const Matrix& CM=SRINullMatrix) + void measurementUpdate(const Matrix& H, Vector& D, + const Matrix& CM=SRINullMatrix) + throw(MatrixException,VectorException); + + /// SRIF (Kalman) simple linear measurement update with optional weight matrix + /// SparseMatrix version + /// @param H Partials matrix, dimension MxN. + /// @param D Data vector, length M; on output D is post-fit residuals. + /// @param CM Measurement covariance matrix, dimension MxM. + /// @throw if dimension N does not match dimension of SRI, or if other + /// dimensions are inconsistent, or if CM is singular. + void measurementUpdate(const SparseMatrix& H, Vector& D, + const SparseMatrix& CM=SRINullSparseMatrix) throw(MatrixException,VectorException); /// SRIF (Kalman) time update diff --git a/ext/lib/Geomatics/SRIMatrix.hpp b/ext/lib/Geomatics/SRIMatrix.hpp index 3eaee5002..409bbdc66 100644 --- a/ext/lib/Geomatics/SRIMatrix.hpp +++ b/ext/lib/Geomatics/SRIMatrix.hpp @@ -49,8 +49,8 @@ // GPSTk #include "Vector.hpp" #include "Matrix.hpp" -#include "StringUtils.hpp" // geomatics +#include "SparseMatrix.hpp" namespace gpstk { @@ -130,13 +130,12 @@ namespace gpstk Z = Vector(A.cols()-1,0.0); } else { - MatrixException me("Invalid input dimensions:\n R has dimension " - + StringUtils::asString(R.rows()) + "x" - + StringUtils::asString(R.cols()) + ",\n Z has length " - + StringUtils::asString(Z.size()) + ",\n and A has dimension " - + StringUtils::asString(A.rows()) + "x" - + StringUtils::asString(A.cols())); - GPSTK_THROW(me); + std::ostringstream oss; + oss << "Invalid input dimensions:\n R has dimension " + << R.rows() << "x" << R.cols() << ",\n Z has length " + << Z.size() << ",\n and A has dimension " + << A.rows() << "x" << A.cols(); + GPSTK_THROW(MatrixException(oss.str())); } } @@ -203,21 +202,19 @@ namespace gpstk /// otherwise M = 0 (the default) and is ignored. /// @throw MatrixException if the input has inconsistent dimensions. template - void SrifMU(Matrix& R, - Vector& Z, - const Matrix& H, - Vector& D, - unsigned int M=0) - throw(MatrixException) + void SrifMU(Matrix& R, Vector& Z, const Matrix& H, Vector& D, + unsigned int M=0) throw(MatrixException) { - Matrix A; - try { A = H || D; } - catch(MatrixException& me) { GPSTK_RETHROW(me); } + try { + Matrix A; + A = H || D; - SrifMU(R,Z,A,M); + SrifMU(R,Z,A,M); // copy residuals out of A into D - D = Vector(A.colCopy(A.cols()-1)); + D = Vector(A.colCopy(A.cols()-1)); + } + catch(MatrixException& me) { GPSTK_RETHROW(me); } } @@ -248,23 +245,23 @@ namespace gpstk Matrix lowerCholesky(const Matrix& A) throw(MatrixException) { if(A.rows() != A.cols() || A.rows() == 0) { - MatrixException me("Invalid input dimensions: " - + StringUtils::asString(A.rows()) + "x" - + StringUtils::asString(A.cols())); - GPSTK_THROW(me); + std::ostringstream oss; + oss << "Invalid input dimensions: " << A.rows() << "x" << A.cols(); + GPSTK_THROW(MatrixException(oss.str())); } const unsigned int n=A.rows(); unsigned int i,j,k; - Matrix L(n,n,0.0); + Matrix L(n,n,T(0)); for(j=0; j(UT.rows()) + "x" - + StringUtils::asString(UT.cols())); - GPSTK_THROW(me); + std::ostringstream oss; + oss << "Invalid input dimensions: " << UT.rows() << "x" << UT.cols(); + GPSTK_THROW(MatrixException(oss.str())); } unsigned int i,j,k,n=UT.rows(); @@ -348,40 +344,46 @@ namespace gpstk // start at the last row,col dum = UT(n-1,n-1); if(dum == T(0)) { - SingularMatrixException e("Singular matrix"); - GPSTK_THROW(e); + GPSTK_THROW(SingularMatrixException("Singular matrix at element 0")); } big = small = fabs(dum); Inv(n-1,n-1) = T(1)/dum; - if(n == 1) return Inv; // 1x1 matrix - for(i=0; i big) big = fabs(UT(i,i)); if(fabs(UT(i,i)) < small) small = fabs(UT(i,i)); dum = T(1)/UT(i,i); Inv(i,i) = dum; // diagonal element first - // now do off-diagonal elements (i,i+1) to (i,n-1) + // now do off-diagonal elements (i,i+1) to (i,n-1): row i to right for(j=i+1; j(UT.rows()) + "x" - + StringUtils::asString(UT.cols())); - GPSTK_THROW(me); + std::ostringstream oss; + oss << "Invalid input dimensions: " << UT.rows() << "x" << UT.cols(); + GPSTK_THROW(MatrixException(oss.str())); } unsigned int i,j,k; @@ -427,6 +428,68 @@ namespace gpstk } + //--------------------------------------------------------------------------------- + /// Compute inverse of lower triangular matrix, returning smallest and largest + /// eigenvalues. + /// @param LT lower triangular matrix to be inverted + /// @param ptrS pointer to small, on output *ptrS contains smallest eigenvalue. + /// @param ptrB pointer to small, on output *ptrB contains largest eigenvalue. + /// @return inverse of input matrix. + /// @throw MatrixException if input is not square (assumed lower triangular also). + /// @throw SingularMatrixException if input is singular. + template + Matrix inverseLT(const Matrix& LT, T *ptrSmall=NULL, T *ptrBig=NULL) + throw(MatrixException) + { + if(LT.rows() != LT.cols() || LT.rows() == 0) { + std::ostringstream oss; + oss << "Invalid input dimensions: " << LT.rows() << "x" << LT.cols(); + GPSTK_THROW(MatrixException(oss.str())); + } + + unsigned int i,j,k,n=LT.rows(); + T big(0),small(0),sum,dum; + Matrix Inv(LT.rows(),LT.cols(),T(0)); + + // start at the first row,col + dum = LT(0,0); + if(dum == T(0)) { + SingularMatrixException e("Singular matrix at element 0"); + GPSTK_THROW(e); + } + + big = small = fabs(dum); + Inv(0,0) = T(1)/dum; + if(n == 1) return Inv; // 1x1 matrix + //for(i=1; i big) big = fabs(LT(i,i)); + if(fabs(LT(i,i)) < small) small = fabs(LT(i,i)); + dum = T(1)/LT(i,i); + Inv(i,i) = dum; // diagonal element first + + // now do off-diagonal elements to left of diag (i,0) to (i,i-1) + for(j=0; j(N,N,0.0); - Z = Vector(N,0.0); - names = Namelist(N); -} - -//------------------------------------------------------------------------------------ -// constructor given a Namelist, its dimension determines the SRI dimension. -SRIleastSquares::SRIleastSquares(const Namelist& NL) - throw() -{ - defaults(); - if(NL.size() <= 0) return; - R = Matrix(NL.size(),NL.size(),0.0); - Z = Vector(NL.size(),0.0); - names = NL; -} - -//------------------------------------------------------------------------------------ -// explicit constructor - throw if the dimensions are inconsistent. -SRIleastSquares::SRIleastSquares(const Matrix& Rin, - const Vector& Zin, - const Namelist& NLin) - throw(MatrixException) -{ - defaults(); - if(Rin.rows() != Rin.cols() || - Rin.rows() != Zin.size() || - Rin.rows() != NLin.size()) { - MatrixException me("Invalid input dimensions: R is " - + asString(Rin.rows()) + "x" - + asString(Rin.cols()) + ", Z has length " - + asString(Zin.size()) + ", and NL has length " - + asString(NLin.size()) - ); - GPSTK_THROW(me); - } - R = Rin; - Z = Zin; - names = NLin; -} - -//------------------------------------------------------------------------------------ -// operator= -SRIleastSquares& SRIleastSquares::operator=(const SRIleastSquares& right) - throw() -{ - R = right.R; - Z = right.Z; - names = right.names; - iterationsLimit = right.iterationsLimit; - convergenceLimit = right.convergenceLimit; - divergenceLimit = right.divergenceLimit; - doWeight = right.doWeight; - doRobust = right.doRobust; - doLinearize = right.doLinearize; - doSequential = right.doSequential; - doVerbose = right.doVerbose; - valid = right.valid; - number_iterations = right.number_iterations; - number_batches = right.number_batches; - rms_convergence = right.rms_convergence; - condition_number = right.condition_number; - Xsave = right.Xsave; - return *this; -} - -//------------------------------------------------------------------------------------ -// SRI least squares update (not the Kalman measurement update). -// Given data and measurement covariance, compute a solution and -// covariance using the appropriate least squares algorithm. -// @param D Data vector, length M -// Input: raw data -// Output: post-fit residuals -// @param X Solution vector, length N -// Input: nominal solution X0 (zero when doLinearized is false) -// Output: final solution -// @param Cov Covariance matrix, dimension (N,N) -// Input: (If doWeight is true) inverse measurement covariance -// or weight matrix(M,M) -// Output: Solution covariance matrix (N,N) -// @param LSF Pointer to a function which is used to define the equation to be solved. -// LSF arguments are: -// X Nominal solution (input) -// f Values of the equation f(X) (length M) (output) -// P Partials matrix df/dX evaluated at X (dimension M,N) (output) -// When doLinearize is false, LSF should ignore X and return the (constant) -// partials matrix in P and zero in f. -// @return 0 ok -// -1 Problem is underdetermined (M divergence limit, goto quit(failure). -// 15. If i > 1 and rms < convergence limit, goto quit(success) -// 16. If i (number of iterations) >= iteration limit, goto quit(failure) -// 17. Set X0 = X -// 18. Return to step 5. -// 19. quit: if(sequential and failed) set SRI=SRIsave. -// -// From the code: -// 1a. Save SRI (i.e. R, Z) in Rapriori, Zapriori -// 2a. If non-sequential, or if this is the first call, set R=z=0 -- DON'T -// 3a. If sequential and not the first call, X = Xsave -// 4a. if linear, X0=0; else X0 is input. Let NominalX = X0 -// 5a. set number_iterations = 0 -// 6a. start iteration -// 7a. increment number_iterations -// 8a. get partials and f from LSfunc using NominalX -// 9a. if robust, compute weight matrix -// 10a. if number_iterations > 1, restore (R,Z) = (Rapriori,Zapriori) -// 11a. MU : R,Z,Partials,D-f(NominalX),MeasCov(if weighted) -// 12a. Invert to get Xsol [ Xsol = X-NominalX or, if linear = X] -// 13a. if linearized, add NominalX to Xsol; Xsol now == X = new estimate -// 14a. if linear and not robust, quit here -// 15a. if linearized, compute rms_convergence = RMS(Xsol - NominalX) -// 16a. if robust, recompute weights and define rms_convergence = RMS(old-new wts) -// 17a. failed? if so, and sequential, restore (R,Z) = (Rapriori,Zapriori); quit -// 18a. success? quit -// 19a. if linearized NominalX = Xsol; if robust NominalX = X -// 20a. iterate - return to 6a. -// 21a. set X = Xsol for return value -// 22a. save X for next time : Xsave = X -// -int SRIleastSquares::dataUpdate(Vector& D, - Vector& X, - Matrix& Cov, - void (LSF)(Vector& X, - Vector& f, - Matrix& P)) throw(MatrixException) -{ - const int M = D.size(); - const int N = R.rows(); - if(doVerbose) cout << "\nSRIleastSquares::leastSquaresUpdate : M,N are " - << M << "," << N << endl; - - // errors - if(N == 0) { - MatrixException me("Called with zero-sized SRIleastSquares"); - GPSTK_THROW(me); - } - if(doLinearize && M < N) { - MatrixException me( - string("When linearizing, problem must not be underdetermined:\n") - + string(" data dimension is ") + asString(M) - + string(" while state dimension is ") + asString(N)); - GPSTK_THROW(me); - } - if(doSequential && R.rows() != X.size()) { - MatrixException me("Sequential problem has inconsistent dimensions:\n SRI is " - + asString(R.rows()) + "x" - + asString(R.cols()) + " while X has length " - + asString(X.size())); - GPSTK_THROW(me); - } - if(doWeight && doRobust) { - MatrixException me("Cannot have doWeight and doRobust both true."); - GPSTK_THROW(me); - } - // TD disallow Robust and Linearized ? why? - // TD disallow Robust and Sequential ? why? - -try { - int i,iret; - double big,small; - Vector f(M),Xsol(N),NominalX,Res(M),Wts(M,1.0),OldWts(M,1.0); - Matrix Partials(M,N),MeasCov(M,M); - const Matrix Rapriori(R); - const Vector Zapriori(Z); - - // save measurement covariance matrix - if(doWeight) MeasCov=Cov; - - // NO ... this prevents you from giving it apriori information... - // if the first time, clear the stored information - //if(!doSequential || number_batches==0) - // zeroAll(); - - // if sequential and not the first call, NominalX must be the last solution - if(doSequential && number_batches != 0) X = Xsave; - - // nominal solution - if(!doLinearize) { - if((int)X.size() != N) X=Vector(N); - X = 0.0; - } - NominalX = X; - - valid = false; - condition_number = 0.0; - rms_convergence = 0.0; - number_iterations = 0; - iret = 0; - - // iteration loop - do { - number_iterations++; - - // call LSF to get f(NominalX) and Partials(NominalX) - LSF(NominalX,f,Partials); - - // Res will be both pre- and post-fit data residuals - Res = D-f; - if(doVerbose) { - cout << "\nSRIleastSquares::leastSquaresUpdate :"; - if(doLinearize || doRobust) - cout << " Iteration " << number_iterations; - cout << endl; - LabeledVector LNX(names,NominalX); - LNX.message(" Nominal X:"); - cout << LNX << endl; - cout << " Pre-fit data residuals: " - << fixed << setprecision(6) << Res << endl; - } - - // build measurement covariance matrix for robust LS - if(doRobust) { - MeasCov = 0.0; - for(i=0; i 1) { - R = Rapriori; - Z = Zapriori; - } - - // update information with simple MU - if(doVerbose) { - cout << " Meas Cov:"; - for(i=0; i P(Partials); - Cholesky Ch; - if(doRobust || doWeight) { - Ch(MeasCov); - Matrix L = inverse(Ch.L); - P = L * P; - Res = L * Res; - } - - // update with whitened information - SrifMU(R, Z, P, Res); - - // un-whiten the residuals - if(doRobust || doWeight) - Res = Ch.L * Res; - } - - if(doVerbose) { - cout << " Updated information matrix\n" << LabeledMatrix(names,R) << endl; - cout << " Updated information vector\n" << LabeledVector(names,Z) << endl; - } - - // invert - try { getStateAndCovariance(Xsol,Cov,&small,&big); } - catch(SingularMatrixException& sme) { - iret = -2; - break; - } - condition_number = big/small; - if(doVerbose) { - cout << " Condition number: " << scientific << condition_number - << fixed << endl; - cout << " Post-fit data residuals: " - << fixed << setprecision(6) << Res << endl; - } - - // update X: when linearized, solution = dX - if(doLinearize) { - Xsol += NominalX; - } - if(doVerbose) { - LabeledVector LXsol(names,Xsol); - LXsol.message(" Updated X:"); - cout << LXsol << endl; - } - - // linear non-robust is done.. - if(!doLinearize && !doRobust) break; - - // test for convergence of linearization - if(doLinearize) { - rms_convergence = RMS(Xsol - NominalX); - if(doVerbose) { - cout << " RMS convergence : " - << scientific << rms_convergence << fixed << endl; - } - } - - // test for convergence of robust weighting, and compute new weights - if(doRobust) { - // must de-weight post-fit residuals - LSF(Xsol,f,Partials); - Res = D-f; - - // compute a new set of weights - double mad,median; - //for(mad=0.0,i=0; i RobustTuningT*mad) - Wts(i) = RobustTuningT*mad/Res(i); - else - Wts(i) = 1.0; - } - - // test for convergence - rms_convergence = RMS(OldWts - Wts); - if(doVerbose) cout << " Convergence: " - << scientific << setprecision(3) << rms_convergence << endl; - } - - // failures - if(rms_convergence > divergenceLimit) iret=-4; - if(number_iterations >= iterationsLimit) iret=-3; - if(iret) { - if(doSequential) { - R = Rapriori; - Z = Zapriori; - } - break; - } - - // success - if(number_iterations > 1 && rms_convergence < convergenceLimit) break; - - // prepare for another iteration - if(doLinearize) - NominalX = Xsol; - if(doRobust) - NominalX = X; - - } while(1); // end iteration loop - - number_batches++; - if(doVerbose) cout << "Return from SRIleastSquares::leastSquaresUpdate\n\n"; - - if(iret) return iret; - valid = true; - - // output the solution - Xsave = X = Xsol; - - // put residuals of fit into data vector, or weights if Robust - if(doRobust) D = OldWts; - else D = Res; - - return iret; -} -catch(Exception& e) { GPSTK_RETHROW(e); } -} - -//------------------------------------------------------------------------------------ -// output operator -ostream& operator<<(ostream& os, const SRIleastSquares& srif) -{ - Namelist NL(srif.names); - NL += string("State"); - Matrix A; - A = srif.R || srif.Z; - LabeledMatrix LM(NL,A); - LM.setw(os.width()); - LM.setprecision(os.precision()); - os << LM; - return os; -} - -//------------------------------------------------------------------------------------ -// reset the computation, i.e. remove all stored information -void SRIleastSquares::zeroAll(void) -{ - SRI::zeroAll(); - Xsave = 0.0; - number_batches = 0; -} - -//------------------------------------------------------------------------------------ -// reset the computation, i.e. remove all stored information, and -// optionally change the dimension. If N is not input, the -// dimension is not changed. -// @param N new SRIleastSquares dimension (optional). -void SRIleastSquares::Reset(const int N) throw(Exception) -{ - try { - if(N > 0 && N != (int)R.rows()) { - R.resize(N,N,0.0); - Z.resize(N,0.0); - } - else - SRI::zeroAll(N); - if(N > 0) Xsave.resize(N); - Xsave = 0.0; - number_batches = 0; - } - catch(Exception& e) { GPSTK_RETHROW(e); } -} - -//------------------------------------------------------------------------------------ -} // end namespace gpstk +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/** + * @file SRIleastSquares.cpp + * Include file defining class SRIleastSquares, which inherits class SRI and + * implements a general least squares algorithm that includes linear or linearized + * problems, weighting, robust estimation, and sequential estimation. + */ + +//------------------------------------------------------------------------------------ +// GPSTk includes +#include "SRIleastSquares.hpp" +#include "RobustStats.hpp" +#include "StringUtils.hpp" + +//------------------------------------------------------------------------------------ +using namespace std; + +namespace gpstk { +using namespace StringUtils; + +//------------------------------------------------------------------------------------ +// empty constructor +SRIleastSquares::SRIleastSquares(void) throw() +{ defaults(); } + +//------------------------------------------------------------------------------------ +// constructor given the dimension N. +SRIleastSquares::SRIleastSquares(const unsigned int N) + throw() +{ + defaults(); + R = Matrix(N,N,0.0); + Z = Vector(N,0.0); + names = Namelist(N); +} + +//------------------------------------------------------------------------------------ +// constructor given a Namelist, its dimension determines the SRI dimension. +SRIleastSquares::SRIleastSquares(const Namelist& NL) + throw() +{ + defaults(); + if(NL.size() <= 0) return; + R = Matrix(NL.size(),NL.size(),0.0); + Z = Vector(NL.size(),0.0); + names = NL; +} + +//------------------------------------------------------------------------------------ +// explicit constructor - throw if the dimensions are inconsistent. +SRIleastSquares::SRIleastSquares(const Matrix& Rin, + const Vector& Zin, + const Namelist& NLin) + throw(MatrixException) +{ + defaults(); + if(Rin.rows() != Rin.cols() || + Rin.rows() != Zin.size() || + Rin.rows() != NLin.size()) { + MatrixException me("Invalid input dimensions: R is " + + asString(Rin.rows()) + "x" + + asString(Rin.cols()) + ", Z has length " + + asString(Zin.size()) + ", and NL has length " + + asString(NLin.size()) + ); + GPSTK_THROW(me); + } + R = Rin; + Z = Zin; + names = NLin; +} + +//------------------------------------------------------------------------------------ +// operator= +SRIleastSquares& SRIleastSquares::operator=(const SRIleastSquares& right) + throw() +{ + R = right.R; + Z = right.Z; + names = right.names; + iterationsLimit = right.iterationsLimit; + convergenceLimit = right.convergenceLimit; + divergenceLimit = right.divergenceLimit; + doWeight = right.doWeight; + doRobust = right.doRobust; + doLinearize = right.doLinearize; + doSequential = right.doSequential; + doVerbose = right.doVerbose; + valid = right.valid; + number_iterations = right.number_iterations; + number_batches = right.number_batches; + rms_convergence = right.rms_convergence; + condition_number = right.condition_number; + Xsave = right.Xsave; + return *this; +} + +//------------------------------------------------------------------------------------ +// SRI least squares update (not the Kalman measurement update). +// Given data and measurement covariance, compute a solution and +// covariance using the appropriate least squares algorithm. +// @param D Data vector, length M +// Input: raw data +// Output: post-fit residuals +// @param X Solution vector, length N +// Input: nominal solution X0 (zero when doLinearized is false) +// Output: final solution +// @param Cov Covariance matrix, dimension (N,N) +// Input: (If doWeight is true) inverse measurement covariance +// or weight matrix(M,M) +// Output: Solution covariance matrix (N,N) +// @param LSF Pointer to a function which is used to define the equation to be solved. +// LSF arguments are: +// X Nominal solution (input) +// f Values of the equation f(X) (length M) (output) +// P Partials matrix df/dX evaluated at X (dimension M,N) (output) +// When doLinearize is false, LSF should ignore X and return the (constant) +// partials matrix in P and zero in f. +// @return 0 ok +// -1 Problem is underdetermined (M divergence limit, goto quit(failure). +// 15. If i > 1 and rms < convergence limit, goto quit(success) +// 16. If i (number of iterations) >= iteration limit, goto quit(failure) +// 17. Set X0 = X +// 18. Return to step 5. +// 19. quit: if(sequential and failed) set SRI=SRIsave. +// +// From the code: +// 1a. Save SRI (i.e. R, Z) in Rapriori, Zapriori +// 2a. If non-sequential, or if this is the first call, set R=z=0 -- DON'T +// 3a. If sequential and not the first call, X = Xsave +// 4a. if linear, X0=0; else X0 is input. Let NominalX = X0 +// 5a. set number_iterations = 0 +// 6a. start iteration +// 7a. increment number_iterations +// 8a. get partials and f from LSfunc using NominalX +// 9a. if robust, compute weight matrix +// 10a. if number_iterations > 1, restore (R,Z) = (Rapriori,Zapriori) +// 11a. MU : R,Z,Partials,D-f(NominalX),MeasCov(if weighted) +// 12a. Invert to get Xsol [ Xsol = X-NominalX or, if linear = X] +// 13a. if linearized, add NominalX to Xsol; Xsol now == X = new estimate +// 14a. if linear and not robust, quit here +// 15a. if linearized, compute rms_convergence = RMS(Xsol - NominalX) +// 16a. if robust, recompute weights and define rms_convergence = RMS(old-new wts) +// 17a. failed? if so, and sequential, restore (R,Z) = (Rapriori,Zapriori); quit +// 18a. success? quit +// 19a. if linearized NominalX = Xsol; if robust NominalX = X +// 20a. iterate - return to 6a. +// 21a. set X = Xsol for return value +// 22a. save X for next time : Xsave = X +// +int SRIleastSquares::dataUpdate(Vector& D, + Vector& X, + Matrix& Cov, + void (LSF)(Vector& X, + Vector& f, + Matrix& P)) throw(MatrixException) +{ + const int M = D.size(); + const int N = R.rows(); + if(doVerbose) cout << "\nSRIleastSquares::leastSquaresUpdate : M,N are " + << M << "," << N << endl; + + // errors + if(N == 0) { + MatrixException me("Called with zero-sized SRIleastSquares"); + GPSTK_THROW(me); + } + if(doLinearize && M < N) { + MatrixException me( + string("When linearizing, problem must not be underdetermined:\n") + + string(" data dimension is ") + asString(M) + + string(" while state dimension is ") + asString(N)); + GPSTK_THROW(me); + } + if(doSequential && R.rows() != X.size()) { + MatrixException me("Sequential problem has inconsistent dimensions:\n SRI is " + + asString(R.rows()) + "x" + + asString(R.cols()) + " while X has length " + + asString(X.size())); + GPSTK_THROW(me); + } + if(doWeight && doRobust) { + MatrixException me("Cannot have doWeight and doRobust both true."); + GPSTK_THROW(me); + } + // TD disallow Robust and Linearized ? why? + // TD disallow Robust and Sequential ? why? + +try { + int i,iret; + double big,small; + Vector f(M),Xsol(N),NominalX,Res(M),Wts(M,1.0),OldWts(M,1.0); + Matrix Partials(M,N),MeasCov(M,M); + const Matrix Rapriori(R); + const Vector Zapriori(Z); + + // save measurement covariance matrix + if(doWeight) MeasCov=Cov; + + // NO ... this prevents you from giving it apriori information... + // if the first time, clear the stored information + //if(!doSequential || number_batches==0) + // zeroAll(); + + // if sequential and not the first call, NominalX must be the last solution + if(doSequential && number_batches != 0) X = Xsave; + + // nominal solution + if(!doLinearize) { + if((int)X.size() != N) X=Vector(N); + X = 0.0; + } + NominalX = X; + + valid = false; + condition_number = 0.0; + rms_convergence = 0.0; + number_iterations = 0; + iret = 0; + + // iteration loop + do { + number_iterations++; + + // call LSF to get f(NominalX) and Partials(NominalX) + LSF(NominalX,f,Partials); + + // Res will be both pre- and post-fit data residuals + Res = D-f; + if(doVerbose) { + cout << "\nSRIleastSquares::leastSquaresUpdate :"; + if(doLinearize || doRobust) + cout << " Iteration " << number_iterations; + cout << endl; + LabeledVector LNX(names,NominalX); + LNX.message(" Nominal X:"); + cout << LNX << endl; + cout << " Pre-fit data residuals: " + << fixed << setprecision(6) << Res << endl; + } + + // build measurement covariance matrix for robust LS + if(doRobust) { + MeasCov = 0.0; + for(i=0; i 1) { + R = Rapriori; + Z = Zapriori; + } + + // update information with simple MU + if(doVerbose) { + cout << " Meas Cov:"; + for(i=0; i P(Partials); + Matrix CHL; + if(doRobust || doWeight) { + CHL = lowerCholesky(MeasCov); + Matrix L = inverseLT(CHL); + P = L * P; + Res = L * Res; + } + + // update with whitened information + SrifMU(R, Z, P, Res); + + // un-whiten the residuals + if(doRobust || doWeight) // NB same if above creates CHL + Res = CHL * Res; + } + + if(doVerbose) { + cout << " Updated information matrix\n" << LabeledMatrix(names,R) << endl; + cout << " Updated information vector\n" << LabeledVector(names,Z) << endl; + } + + // invert + try { getStateAndCovariance(Xsol,Cov,&small,&big); } + catch(SingularMatrixException& sme) { + iret = -2; + break; + } + condition_number = big/small; + if(doVerbose) { + cout << " Condition number: " << scientific << condition_number + << fixed << endl; + cout << " Post-fit data residuals: " + << fixed << setprecision(6) << Res << endl; + } + + // update X: when linearized, solution = dX + if(doLinearize) { + Xsol += NominalX; + } + if(doVerbose) { + LabeledVector LXsol(names,Xsol); + LXsol.message(" Updated X:"); + cout << LXsol << endl; + } + + // linear non-robust is done.. + if(!doLinearize && !doRobust) break; + + // test for convergence of linearization + if(doLinearize) { + rms_convergence = RMS(Xsol - NominalX); + if(doVerbose) { + cout << " RMS convergence : " + << scientific << rms_convergence << fixed << endl; + } + } + + // test for convergence of robust weighting, and compute new weights + if(doRobust) { + // must de-weight post-fit residuals + LSF(Xsol,f,Partials); + Res = D-f; + + // compute a new set of weights + double mad,median; + //for(mad=0.0,i=0; i RobustTuningT*mad) + Wts(i) = RobustTuningT*mad/Res(i); + else + Wts(i) = 1.0; + } + + // test for convergence + rms_convergence = RMS(OldWts - Wts); + if(doVerbose) cout << " Convergence: " + << scientific << setprecision(3) << rms_convergence << endl; + } + + // failures + if(rms_convergence > divergenceLimit) iret=-4; + if(number_iterations >= iterationsLimit) iret=-3; + if(iret) { + if(doSequential) { + R = Rapriori; + Z = Zapriori; + } + break; + } + + // success + if(number_iterations > 1 && rms_convergence < convergenceLimit) break; + + // prepare for another iteration + if(doLinearize) + NominalX = Xsol; + if(doRobust) + NominalX = X; + + } while(1); // end iteration loop + + number_batches++; + if(doVerbose) cout << "Return from SRIleastSquares::leastSquaresUpdate\n\n"; + + if(iret) return iret; + valid = true; + + // output the solution + Xsave = X = Xsol; + + // put residuals of fit into data vector, or weights if Robust + if(doRobust) D = OldWts; + else D = Res; + + return iret; +} +catch(Exception& e) { GPSTK_RETHROW(e); } +} + +//------------------------------------------------------------------------------------ +// output operator +ostream& operator<<(ostream& os, const SRIleastSquares& srif) +{ + Namelist NL(srif.names); + NL += string("State"); + Matrix A; + A = srif.R || srif.Z; + LabeledMatrix LM(NL,A); + LM.setw(os.width()); + LM.setprecision(os.precision()); + os << LM; + return os; +} + +//------------------------------------------------------------------------------------ +// reset the computation, i.e. remove all stored information +void SRIleastSquares::zeroAll(void) +{ + SRI::zeroAll(); + Xsave = 0.0; + number_batches = 0; +} + +//------------------------------------------------------------------------------------ +// reset the computation, i.e. remove all stored information, and +// optionally change the dimension. If N is not input, the +// dimension is not changed. +// @param N new SRIleastSquares dimension (optional). +void SRIleastSquares::Reset(const int N) throw(Exception) +{ + try { + if(N > 0 && N != (int)R.rows()) { + R.resize(N,N,0.0); + Z.resize(N,0.0); + } + else + SRI::zeroAll(N); + if(N > 0) Xsave.resize(N); + Xsave = 0.0; + number_batches = 0; + } + catch(Exception& e) { GPSTK_RETHROW(e); } +} + +//------------------------------------------------------------------------------------ +} // end namespace gpstk diff --git a/ext/lib/Geomatics/SRIleastSquares.hpp b/ext/lib/Geomatics/SRIleastSquares.hpp index ea828ba34..ab0647d63 100644 --- a/ext/lib/Geomatics/SRIleastSquares.hpp +++ b/ext/lib/Geomatics/SRIleastSquares.hpp @@ -1,252 +1,251 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -/** - * @file SRIleastSquares.hpp - * Include file defining class SRIleastSquares, which inherits class SRI and - * implements a general least squares algorithm that includes linear or linearized - * problems, weighting, robust estimation, and sequential estimation. - */ - -//------------------------------------------------------------------------------------ -#ifndef CLASS_SRI_LEAST_SQUARES_INCLUDE -#define CLASS_SRI_LEAST_SQUARES_INCLUDE - -//------------------------------------------------------------------------------------ -// system -#include -// GPSTk -#include "Vector.hpp" -#include "Matrix.hpp" -#include "SRI.hpp" - -namespace gpstk { - -//------------------------------------------------------------------------------------ -/** class SRIleastSquares inherits SRI and implements a general least squares - * algorithm using SRI, including weighted, linear or linearized, robust and/or - * sequential algorithms. - * - * At any point the state X and covariance P are related to the SRI by - * X = inverse(R) * z , P = inverse(R) * inverse(transpose(R)), or - * R = upper triangular square root (Cholesky decomposition) of the inverse of P, - * and z = R * X. - */ -class SRIleastSquares : public SRI { -public: - /// empty constructor - SRIleastSquares(void) throw(); - - /// constructor given the dimension N. - /// @param N dimension of the SRIleastSquares. - SRIleastSquares(const unsigned int N) - throw(); - - /// constructor given a Namelist; its dimension determines the SRI dimension. - /// @param NL Namelist for the SRIleastSquares. - SRIleastSquares(const Namelist& NL) - throw(); - - /// explicit constructor - throw if the dimensions are inconsistent. - /// @param R Initial information matrix, an upper triangular matrix of dim N. - /// @param Z Initial information data vector, of length N. - /// @param NL Namelist for the SRIleastSquares, also of length N. - /// @throw MatrixException if dimensions are not consistent. - SRIleastSquares(const Matrix& R, - const Vector& Z, - const Namelist& NL) - throw(MatrixException); - - /// copy constructor - /// @param right SRIleastSquares to be copied - SRIleastSquares(const SRIleastSquares& right) - throw() - { *this = right; } - - /// operator= - /// @param right SRIleastSquares to be copied - SRIleastSquares& operator=(const SRIleastSquares& right) - throw(); - - /// A general least squares update, NOT the SRIF (Kalman) measurement update. - /// Given data and measurement covariance, compute a solution and - /// covariance using the appropriate least squares algorithm. - /// @param D Data vector, length M - /// Input: raw data - /// Output: post-fit residuals - /// @param X Solution vector, length N - /// Input: nominal solution X0 (zero when doLinearized is false) - /// Output: final solution - /// @param Cov Covariance matrix, dimension (N,N) - /// Input: (If doWeight is true) inverse measurement covariance - /// or weight matrix(M,M) - /// Output: Solution covariance matrix (N,N) - /// @param LSF Pointer to a function which is used to define the equation - /// to be solved. - /// LSF arguments are: - /// X Nominal solution (input) - /// f Values of the equation f(X) (length M) (output) - /// P Partials matrix df/dX evaluated at X (dimension M,N) (output) - /// When doLinearize is false, LSF ignores X and returns the (constant) - /// partials matrix P and zero for f(X). - /// @throw MatrixException if the input is inconsistent - /// Return values: 0 ok - /// -1 Problem is underdetermined (M& D, - Vector& X, - Matrix& Cov, - void (LSF)(Vector& X, - Vector& f, - Matrix& P) - ) - throw(MatrixException); - - /// output operator - friend std::ostream& operator<<(std::ostream& s, - const SRIleastSquares& srif); - - /// remove all stored information by setting the SRI to zero - /// (does not re-dimension). - void zeroAll(void); - - /// Return true if the solution is valid, i.e. if the problem is non-singular. - bool isValid() { return valid; } - - /// reset the computation, i.e. remove all stored information, and - /// optionally change the dimension. If N is not input, the - /// dimension is not changed. - /// @param N new SRIleastSquares dimension (optional). - void Reset(const int N=0) throw(Exception); - - // ------------- member functions --------------- - /// Get the current solution vector - /// @return current solution vector - Vector Solution(void) { return Xsave; } - - /// Get the number of iterations used in last call to leastSquaresEstimation() - /// @return the number of iterations - int Iterations() { return number_iterations; } - - /// Get the convergence value found in last call to leastSquaresEstimation() - /// @return the convergence value - double Convergence() { return rms_convergence; } - - /// Get the condition number of the covariance matrix from last calls - /// to leastSquaresEstimation() (Larger means 'closer to singular' except - /// zero means condition number is infinite) - double ConditionNumber() { return condition_number; } - - // ------------- member data --------------- - /// limit on the number of iterations - int iterationsLimit; - - /// limit on the RSS change in solution which produces success - double convergenceLimit; - - /// upper limit on the RSS change in solution which produces an abort - double divergenceLimit; - - /// if true, weight the equation using the inverse of covariance matrix - /// on input - default is false - bool doWeight; - - /// if true, weight the equation using robust statistical techniques - /// - default is false - bool doRobust; - - /// if true, save information for a sequential solution - default is false - bool doSequential; - - /// if true, equation F(X)=D is non-linear, the algorithm will be iterated, - /// and LSF must return partials matrix and F(X). - default is false - bool doLinearize; - - /// if true, output intermediate results - bool doVerbose; - -private: - /// initialization used by constructors - leastSquaresEstimation() only - void defaults(void) throw() - { - iterationsLimit = 10; - convergenceLimit = 1.e-8; - divergenceLimit = 1.e10; - doWeight = false; - doRobust = false; - doLinearize = false; - doSequential = false; - doVerbose = false; - number_iterations = number_batches = 0; - rms_convergence = condition_number = 0.0; - valid = false; - } - - // private member data - inherits from SRI - // inherit SRI Information matrix, an upper triangular (square) matrix - //Matrix R; - // inherit SRI state vector, of length equal to dimension (row and col) of R. - //Vector Z; - // inherit SRI Namelist parallel to R and Z, labelling elements of state vector. - //Namelist names; - - // --------- private member data ------------ - /// indicates if the filter is valid - set false when singular - bool valid; - - /// current number of iterations - int number_iterations; - - /// current number of batches seen - int number_batches; - - /// RMS change in state, used for convergence test - double rms_convergence; - - /// condition number, defined in inversion to get state and covariance - double condition_number; - - /// solution X consistent with current information RX=z - Vector Xsave; - -}; // end class SRIleastSquares - -} // end namespace gpstk - -//------------------------------------------------------------------------------------ -#endif +/// @file SRIleastSquares.hpp +/// Include file defining class SRIleastSquares, which inherits class SRI and +/// implements a general least squares algorithm that includes linear or linearized +/// problems, weighting, robust estimation, and sequential estimation. + +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +//------------------------------------------------------------------------------------ +#ifndef CLASS_SRI_LEAST_SQUARES_INCLUDE +#define CLASS_SRI_LEAST_SQUARES_INCLUDE + +//------------------------------------------------------------------------------------ +// system +#include +// GPSTk +#include "Vector.hpp" +#include "Matrix.hpp" +#include "SRI.hpp" + +namespace gpstk { + +//------------------------------------------------------------------------------------ +/// class SRIleastSquares inherits SRI and implements a general least squares +/// algorithm using SRI, including weighted, linear or linearized, robust and/or +/// sequential algorithms. +/// +/// At any point the state X and covariance P are related to the SRI by +/// X = inverse(R) * z , P = inverse(R) * inverse(transpose(R)), or +/// R = upper triangular square root (Cholesky decomposition) of the inverse of P, +/// and z = R * X. +class SRIleastSquares : public SRI { +public: + /// empty constructor + SRIleastSquares(void) throw(); + + /// constructor given the dimension N. + /// @param N dimension of the SRIleastSquares. + SRIleastSquares(const unsigned int N) + throw(); + + /// constructor given a Namelist; its dimension determines the SRI dimension. + /// @param NL Namelist for the SRIleastSquares. + SRIleastSquares(const Namelist& NL) + throw(); + + /// explicit constructor - throw if the dimensions are inconsistent. + /// @param R Initial information matrix, an upper triangular matrix of dim N. + /// @param Z Initial information data vector, of length N. + /// @param NL Namelist for the SRIleastSquares, also of length N. + /// @throw MatrixException if dimensions are not consistent. + SRIleastSquares(const Matrix& R, + const Vector& Z, + const Namelist& NL) + throw(MatrixException); + + /// copy constructor + /// @param right SRIleastSquares to be copied + SRIleastSquares(const SRIleastSquares& right) + throw() + { *this = right; } + + /// operator= + /// @param right SRIleastSquares to be copied + SRIleastSquares& operator=(const SRIleastSquares& right) + throw(); + + /// A general least squares update, NOT the SRIF (Kalman) measurement update. + /// Given data and measurement covariance, compute a solution and + /// covariance using the appropriate least squares algorithm. + /// @param D Data vector, length M + /// Input: raw data + /// Output: post-fit residuals + /// @param X Solution vector, length N + /// Input: nominal solution X0 (zero when doLinearized is false) + /// Output: final solution + /// @param Cov Covariance matrix, dimension (N,N) + /// Input: (If doWeight is true) inverse measurement covariance + /// or weight matrix(M,M) + /// Output: Solution covariance matrix (N,N) + /// @param LSF Pointer to a function which is used to define the equation + /// to be solved. + /// LSF arguments are: + /// X Nominal solution (input) + /// f Values of the equation f(X) (length M) (output) + /// P Partials matrix df/dX evaluated at X (dimension M,N) (output) + /// When doLinearize is false, LSF ignores X and returns the (constant) + /// partials matrix P and zero for f(X). + /// @throw MatrixException if the input is inconsistent + /// Return values: 0 ok + /// -1 Problem is underdetermined (M& D, + Vector& X, + Matrix& Cov, + void (LSF)(Vector& X, + Vector& f, + Matrix& P) + ) + throw(MatrixException); + + /// output operator + friend std::ostream& operator<<(std::ostream& s, + const SRIleastSquares& srif); + + /// remove all stored information by setting the SRI to zero + /// (does not re-dimension). + void zeroAll(void); + + /// Return true if the solution is valid, i.e. if the problem is non-singular. + bool isValid() { return valid; } + + /// reset the computation, i.e. remove all stored information, and + /// optionally change the dimension. If N is not input, the + /// dimension is not changed. + /// @param N new SRIleastSquares dimension (optional). + void Reset(const int N=0) throw(Exception); + + // ------------- member functions --------------- + /// Get the current solution vector + /// @return current solution vector + Vector Solution(void) { return Xsave; } + + /// Get the number of iterations used in last call to leastSquaresEstimation() + /// @return the number of iterations + int Iterations() { return number_iterations; } + + /// Get the convergence value found in last call to leastSquaresEstimation() + /// @return the convergence value + double Convergence() { return rms_convergence; } + + /// Get the condition number of the covariance matrix from last calls + /// to leastSquaresEstimation() (Larger means 'closer to singular' except + /// zero means condition number is infinite) + double ConditionNumber() { return condition_number; } + + // ------------- member data --------------- + /// limit on the number of iterations + int iterationsLimit; + + /// limit on the RSS change in solution which produces success + double convergenceLimit; + + /// upper limit on the RSS change in solution which produces an abort + double divergenceLimit; + + /// if true, weight the equation using the inverse of covariance matrix + /// on input - default is false + bool doWeight; + + /// if true, weight the equation using robust statistical techniques + /// - default is false + /// (NB robust & sequential doesn't make much sense) + bool doRobust; + + /// if true, save information for a sequential solution - default is false + /// (NB robust & sequential doesn't make much sense) + bool doSequential; + + /// if true, equation F(X)=D is non-linear, the algorithm will be iterated, + /// and LSF must return partials matrix and F(X). - default is false + bool doLinearize; + + /// if true, output intermediate results + bool doVerbose; + +private: + /// initialization used by constructors - leastSquaresEstimation() only + void defaults(void) throw() + { + iterationsLimit = 10; + convergenceLimit = 1.e-8; + divergenceLimit = 1.e10; + doWeight = false; + doRobust = false; + doLinearize = false; + doSequential = false; + doVerbose = false; + number_iterations = number_batches = 0; + rms_convergence = condition_number = 0.0; + valid = false; + } + + // private member data - inherits from SRI + // inherit SRI Information matrix, an upper triangular (square) matrix + //Matrix R; + // inherit SRI state vector, of length equal to dimension (row and col) of R. + //Vector Z; + // inherit SRI Namelist parallel to R and Z, labelling elements of state vector. + //Namelist names; + + // --------- private member data ------------ + /// indicates if the filter is valid - set false when singular + bool valid; + + /// current number of iterations + int number_iterations; + + /// current number of batches seen + int number_batches; + + /// RMS change in state, used for convergence test + double rms_convergence; + + /// condition number, defined in inversion to get state and covariance + double condition_number; + + /// solution X consistent with current information RX=z + Vector Xsave; + +}; // end class SRIleastSquares + +} // end namespace gpstk + +//------------------------------------------------------------------------------------ +#endif diff --git a/ext/lib/Geomatics/SolarSystem.cpp b/ext/lib/Geomatics/SolarSystem.cpp index 10cf49f5b..80dcac490 100644 --- a/ext/lib/Geomatics/SolarSystem.cpp +++ b/ext/lib/Geomatics/SolarSystem.cpp @@ -200,7 +200,7 @@ try { store.clear(); } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -240,7 +240,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -319,7 +319,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -405,7 +405,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -448,7 +448,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -567,7 +567,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -585,7 +585,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -608,7 +608,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -700,7 +700,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -729,7 +729,7 @@ try { return result; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -747,7 +747,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -763,7 +763,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -888,7 +888,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -942,7 +942,7 @@ try { return iret; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -972,7 +972,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1013,7 +1013,7 @@ try { return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -1078,7 +1078,7 @@ try { } } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/lib/Geomatics/SolidEarthTides.cpp b/ext/lib/Geomatics/SolidEarthTides.cpp index 744fb3d95..f40c1a020 100644 --- a/ext/lib/Geomatics/SolidEarthTides.cpp +++ b/ext/lib/Geomatics/SolidEarthTides.cpp @@ -479,7 +479,7 @@ try { return disp; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -559,7 +559,7 @@ try { return dispXYZ; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } diff --git a/ext/lib/Geomatics/SparseMatrix.hpp b/ext/lib/Geomatics/SparseMatrix.hpp new file mode 100644 index 000000000..1c24289cc --- /dev/null +++ b/ext/lib/Geomatics/SparseMatrix.hpp @@ -0,0 +1,2150 @@ +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/// @file SparseMatrix.hpp Class for template sparse matrices; use with SparseVector. + +#ifndef SPARSE_MATRIX_INCLUDE +#define SPARSE_MATRIX_INCLUDE + +#include +#include +#include // for find,lower_bound + +#include "SparseVector.hpp" +#include "Matrix.hpp" + +// TODO +// >trace +// >add concatenations {&& ||}{SM SV M V} to SparseMatrix +// >add minabs maxabs to Matrix +// notes +// >potential trap in that rowsMap[.].len may not agree with ncols... +// >do we want a cast-to-Matrix function? Or do we want to replace with explicit func? +// >watch out for implicit casts to Matrix - this could really confuse things. +// compiler could silently cast to Matrix to access some Matrix::func not found here +// ?create Matrix from SparseMatrix using an explicit function rather than cast? +// >can you define SV::zeroTolerance = 1.e-14; SV::zeroTolerance = 1; +// >document +// +// v >inverse,LUD,SVD,HH - only inverse Cholesky for now...cast to Matrix? +// costly to implement, how much benefit? HH is used in SRIF +// not able to speed up LUD and SVD - cast to Matrix. Chol, HH< SRIFMU done. +// v >go through all the code and avoid using proxys; access maps directly; SV friend +// v >is rowsMap.insert(pair(j,SparseVector) faster than rowsMap[j] = SV ? +// stackoverflow says no +// v >worry about SparseVector::zeroTolerance - make it set-able? No, pass it +// v > To zeroize or not? that is the question. If you zeroize inside routines here, +// there is the risk that you'll ruin the content of your data. For example, a +// m. cov. matrix where you set one value very small, to effectively constrain. +// If you zeroize in, say, lowerCholesky, you may very well set it to zero which +// would make the matrix singular. +// *** Zeroize ONLY when the user explicitly calls zeroize(), and let him pass the +// tolerance, except call zeroize(T(0)) after operations that might create zeros. +// Even better, ** never add zeros to the map ** + +namespace gpstk +{ + // forward declarations + template class SparseMatrix; + + //--------------------------------------------------------------------------- + /// Proxy class for elements of the SparseMatrix (SM). + template class SMatProxy + { + public: + /// constructor + SMatProxy(SparseMatrix& SM, unsigned int i, unsigned int j); + + /// operator = for non-const (lvalue) + SMatProxy& operator=(const SMatProxy& rhs) + { assign(rhs); return *this; } + /// operator = for const (rvalue) + SMatProxy& operator=(T rhs) + { assign(rhs); return *this; } + + /// cast or implicit conversion + operator T() const; + + /// operator+= for non-const (lvalue) + SMatProxy& operator+=(const SMatProxy& rhs) + { assign(value()+rhs); return *this; } + + /// operator+= for const (rvalue) + SMatProxy& operator+=(T rhs) + { assign(value()+rhs); return *this; } + + /// operator-= for non-const (lvalue) + SMatProxy& operator-=(const SMatProxy& rhs) + { assign(value()-rhs); return *this; } + + /// operator-= for const (rvalue) + SMatProxy& operator-=(T rhs) + { assign(value()-rhs); return *this; } + + /// operator*= for non-const (lvalue) + SMatProxy& operator*=(const SMatProxy& rhs) + { assign(value()*rhs); return *this; } + + /// operator*= for const (rvalue) + SMatProxy& operator*=(T rhs) + { assign(value()*rhs); return *this; } + + private: + /// reference to the matrix to which this data belongs + SparseMatrix& mySM; + + /// indexes in mySM for this data + unsigned int irow, jcol; + + /// get the value of the SparseMatrix at irow,jcol + T value(void) const; + + /// assign the SparseMatrix element, used by operator=,+=,etc + void assign(T rhs); + + }; // end class SMatProxy + + //--------------------------------------------------------------------------- + // implementation of SMatProxy + //--------------------------------------------------------------------------- + // Default constructor + template + SMatProxy::SMatProxy(SparseMatrix& sm, unsigned int i, unsigned int j) + : mySM(sm), irow(i), jcol(j) { } + + //--------------------------------------------------------------------------- + // get the value of the SparseMatrix at irow, jcol + template T SMatProxy::value(void) const + { + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = mySM.rowsMap.find(irow); + if(it != mySM.rowsMap.end()) + return it->second[jcol]; + + return T(); + } + + //--------------------------------------------------------------------------- + // assignment, used by operator=, operator+=, etc + template void SMatProxy::assign(T rhs) + { + typename std::map< unsigned int, SparseVector >::iterator it; + it = mySM.rowsMap.find(irow); + + // add a new row? only if row is not there, and rhs is not zero + if(T(rhs) != T(0) && it == mySM.rowsMap.end()) { + SparseVector SVrow(mySM.ncols); + mySM.rowsMap[irow] = SVrow; + it = mySM.rowsMap.find(irow); + } + // data is zero and row is not there...nothing to do + else if(it == mySM.rowsMap.end()) return; + + // assign it - let SparseVector::SMatProxy handle r/lvalue + // first, do we need to resize the SV? + if(it->second.size() < jcol+1) it->second.resize(jcol+1); + it->second[jcol] = rhs; + + // if row is now empty, remove it + if(it->second.datasize() == 0) + mySM.rowsMap.erase(it); + } + + //--------------------------------------------------------------------------- + // cast + template SMatProxy::operator T() const + { + typename std::map< unsigned int, SparseVector >::iterator it; + it = mySM.rowsMap.find(irow); + if(it == mySM.rowsMap.end()) + return T(); + else + return it->second[jcol]; + } + + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // friends of class SparseMatrix - must declare friends before the template class + // min max + template T min(const SparseMatrix& SM); + template T max(const SparseMatrix& SM); + template T minabs(const SparseMatrix& SM); + template T maxabs(const SparseMatrix& SM); + // output + template + std::ostream& operator<<(std::ostream& os, const SparseMatrix& SM); + // transpose + template + SparseMatrix transpose(const SparseMatrix& M); + // multiplies + template + SparseMatrix operator*(const SparseMatrix& L, const SparseMatrix& R); + template + SparseVector operator*(const SparseMatrix& L, const SparseVector& V); + template + SparseVector operator*(const Matrix& L, const SparseVector& V); + template + SparseVector operator*(const SparseMatrix& L, const Vector& V); + template + SparseVector operator*(const SparseVector& V, const SparseMatrix& R); + template + SparseVector operator*(const SparseVector& V, const Matrix& R); + template + SparseVector operator*(const Vector& V, const SparseMatrix& R); + template + SparseMatrix operator*(const SparseMatrix& L, const SparseMatrix& R); + template + SparseMatrix operator*(const SparseMatrix& L, const Matrix& R); + template + SparseMatrix operator*(const Matrix& L, const SparseMatrix& R); + // concatenation + template + SparseMatrix operator||(const SparseMatrix& L, const Vector& V); + template + SparseMatrix operator||(const SparseMatrix& L, const SparseMatrix& R); + // addition and subtraction + template SparseMatrix operator-(const SparseMatrix& L, + const SparseMatrix& R); + template SparseMatrix operator-(const SparseMatrix& L, + const Matrix& R); + template SparseMatrix operator-(const Matrix& L, + const SparseMatrix& R); + template SparseMatrix operator+(const SparseMatrix& L, + const SparseMatrix& R); + template SparseMatrix operator+(const SparseMatrix& L, + const Matrix& R); + template SparseMatrix operator+(const Matrix& L, + const SparseMatrix& R); + // inverse (via Gauss-Jordan) + template + SparseMatrix inverse(const SparseMatrix& A) throw(Exception); + // Cholesky + template + SparseMatrix lowerCholesky(const SparseMatrix& A) throw(Exception); + template + SparseMatrix upperCholesky(const SparseMatrix& A) throw(Exception); + // inverseLT + template + SparseMatrix inverseLT(const SparseMatrix& LT, T *ptrSmall, T *ptrBig) + throw(Exception); + template + SparseMatrix inverseViaCholesky(const SparseMatrix& A) throw(Exception); + + // special matrices + template + SparseMatrix identSparse(const unsigned int dim) throw(); + + // products MT*M, M*MT, M*C*MT etc + // MT * M + template + SparseMatrix transposeTimesMatrix(const SparseMatrix& M) throw(Exception); + // M * MT + template + SparseMatrix matrixTimesTranspose(const SparseMatrix& M) throw(Exception); + // diag of P * C * PT + template Vector transformDiag(const SparseMatrix& P, + const Matrix& C) throw(Exception); + + // Householder + template + SparseMatrix SparseHouseholder(const SparseMatrix& A) throw(Exception); + + template void SrifMU(Matrix& R, Vector& Z, SparseMatrix& A, + const unsigned int M) throw(Exception); + template void SrifMU(Matrix& R, Vector& Z, SparseMatrix& P, + Vector& D, const unsigned int M) throw(Exception); + + //--------------------------------------------------------------------------- + /// Class SparseMatrix. This class is designed to present an interface nearly + /// identical to class Matrix, but more efficiently handle sparse matrices, in + /// which most of the elements are zero. The class stores only non-zero elements; + /// using a map of SparseVectors, with key = row index. it also stores a nominal + /// dimension - number of rows and columns. The class uses a proxy class, + /// SMatProxy, to access elements; this allows rvalues and lvalues to be treated + /// separately. + /// Notes on speed. The most expensive parts are the Proxy::operator(), then + /// find() and lower_bound(). Never use the Proxy stuff within the class, always + /// use iterators and assign values to the maps directly. Never assign zeros to + /// the maps. See timing and test results in the test program smtest.cpp + /// Matrix multiply is orders of magnitude faster. Transpose() is much faster + /// than the Matrix version, which is something of a surprise. + /// Most time consuming is looping over columns; this is expected since the design + /// stores by row. The trick is to re-write the algorithm in terms of the transpose + /// of the column-loop matrix, and then apply a transpose(), which is cheap, either + /// before starting (when col-loop matrix is input) or after returning (output). + /// Then the loops become loops over rows. + /// NB. never store zeros in the map, particularly when you are creating the + /// matrix and using it at the same time, as in inverseLT(). + template class SparseMatrix + { + public: + // lots of friends + /// Proxy needs access to rowsMap + friend class SMatProxy; + // min max + friend T min(const SparseMatrix& SM); + friend T max(const SparseMatrix& SM); + friend T minabs(const SparseMatrix& SM); + friend T maxabs(const SparseMatrix& SM); + // stream operator + friend std::ostream& operator<< (std::ostream& os, const SparseMatrix& S); + // transpose + friend SparseMatrix transpose(const SparseMatrix& M); + // arithmetic + friend SparseMatrix operator-(const SparseMatrix& L, + const SparseMatrix& R); + friend SparseMatrix operator-(const SparseMatrix& L, + const Matrix& R); + friend SparseMatrix operator-(const Matrix& L, + const SparseMatrix& R); + friend SparseMatrix operator+(const SparseMatrix& L, + const SparseMatrix& R); + friend SparseMatrix operator+(const SparseMatrix& L, + const Matrix& R); + friend SparseMatrix operator+(const Matrix& L, + const SparseMatrix& R); + // mulitply + friend SparseMatrix operator*(const SparseMatrix& L, + const SparseMatrix& R); + friend SparseVector operator*(const SparseMatrix& L, + const SparseVector& V); + friend SparseVector operator*(const Matrix& L, + const SparseVector& V); + friend SparseVector operator*(const SparseMatrix& L, + const Vector& V); + friend SparseVector operator*(const SparseVector& V, + const SparseMatrix& R); + friend SparseVector operator*(const SparseVector& V, + const Matrix& R); + friend SparseVector operator*(const Vector& V, + const SparseMatrix& R); + friend SparseMatrix operator*(const SparseMatrix& L, + const SparseMatrix& R); + friend SparseMatrix operator*(const SparseMatrix& L, + const Matrix& R); + friend SparseMatrix operator*(const Matrix& L, + const SparseMatrix& R); + // concatenation + friend SparseMatrix operator||(const SparseMatrix& L, + const Vector& V); + friend SparseMatrix operator||(const SparseMatrix& L, + const SparseMatrix& R); + // inverse (via Gauss-Jordan) + friend SparseMatrix inverse(const SparseMatrix& A) throw(Exception); + // Cholesky + friend SparseMatrix lowerCholesky(const SparseMatrix& A) + throw(Exception); + friend SparseMatrix upperCholesky(const SparseMatrix& A) + throw(Exception); + friend SparseMatrix inverseLT(const SparseMatrix& LT, + T *ptrSmall, T *ptrBig) throw(Exception); + friend SparseMatrix inverseViaCholesky(const SparseMatrix& A) + throw(Exception); + // special matrices + friend SparseMatrix identSparse(const unsigned int dim) throw(); + + // MT * M + friend SparseMatrix transposeTimesMatrix(const SparseMatrix& M) + throw(Exception); + // M * MT + friend SparseMatrix matrixTimesTranspose(const SparseMatrix& M) + throw(Exception); + // diag of P * C * PT + friend Vector transformDiag(const SparseMatrix& P, + const Matrix& C) throw(Exception); + friend SparseMatrix SparseHouseholder(const SparseMatrix& A) + throw(Exception); + friend void SrifMU(Matrix& R, Vector& Z, SparseMatrix& A, + const unsigned int M) throw(Exception); + friend void SrifMU(Matrix& R, Vector& Z, SparseMatrix& P, + Vector& D, const unsigned int M) throw(Exception); + + /// empty constructor + SparseMatrix(void) : nrows(0), ncols(0) { } + + /// constructor with dimensions + SparseMatrix(unsigned int r, unsigned int c) : nrows(r), ncols(c) { } + + /// sub-matrix constructor + /// @param SV SparseVector to copy + /// @param ind starting index for the copy + /// @param n length of new SparseVector + SparseMatrix(const SparseMatrix& SM, + const unsigned int& rind, const unsigned int& cind, + const unsigned int& rnum, const unsigned int& cnum); + + /// constructor from regular Matrix + SparseMatrix(const Matrix& M); + + // TD watch for unintended consequences - cast to Matrix to use some Matrix::fun + /// cast to Matrix or implicit conversion to Matrix + operator Matrix() const; + + /// get number of rows - of the real Matrix, not the data array + inline unsigned int rows(void) const { return nrows; } + + /// get number of columns - of the real Matrix, not the data array + inline unsigned int cols(void) const { return ncols; } + + /// size of matrix = rows()*cols() + inline unsigned int size(void) const { return nrows*ncols; } + + /// datasize - number of non-zero data + inline unsigned int datasize(void) const + { + unsigned int n(0); + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = rowsMap.begin(); + for( ; it != rowsMap.end(); ++it) + n += it->second.datasize(); + return n; + } + + /// is this SM empty? NB may have to call zeroize() to get a yes. + inline bool isEmpty(void) const + { return (rowsMap.begin() == rowsMap.end()); } + + /// density - ratio of number of non-zero element to size() + inline double density(void) const + { return (double(datasize())/double(size())); } + + /// resize - only changes len and removes elements if necessary + void resize(const unsigned int newrows, const unsigned int newcols) + { + typename std::map< unsigned int, SparseVector >::iterator it; + if(newrows < nrows) { + // lower_bound returns it for first key >= newrows + it = rowsMap.lower_bound(newrows); + rowsMap.erase(it,rowsMap.end()); + } + if(newcols < ncols) + for(it=rowsMap.begin(); it != rowsMap.end(); ++it) + it->second.resize(newcols); + + nrows = newrows; + ncols = newcols; + } + + /// clear - set all data to 0 (i.e. remove all data); leave dimensions alone + inline void clear(void) + { rowsMap.clear(); } + + /// zeroize - remove elements that are less than tolerance in abs value + /// NB. This routine is called only by the user - routines defined here do not + /// zeroize, as there is no way to appropriately choose a tolerance. + /// The default tolerance for this routine is SparseVector::zeroTolerance. + /// The caller may want to consider a tolerance related to SM.maxabs(). + void zeroize(const T tol=static_cast(SparseVector::zeroTolerance)); + + /// true if the element (i,j) is non-zero + inline bool isFilled(const unsigned int i, const unsigned int j) + { + typename std::map< unsigned int, SparseVector >::iterator it; + it = rowsMap.find(i); + return (it != rowsMap.end() && it->second.isFilled(j)); + } + + // operators ---------------------------------------------------- + /// operator() for const, but SMatProxy does all the work + const SMatProxy operator()(unsigned int i, unsigned int j) const + { + #ifdef RANGECHECK + if(i >= nrows) GPSTK_THROW(Exception("row index out of range")); + if(j >= ncols) GPSTK_THROW(Exception("col index out of range")); + #endif + return SMatProxy(const_cast(*this), i, j); + } + + /// operator() for non-const, but SMatProxy does all the work + SMatProxy operator()(unsigned int i, unsigned int j) + { + #ifdef RANGECHECK + if(i >= nrows) GPSTK_THROW(Exception("row index out of range")); + if(j >= ncols) GPSTK_THROW(Exception("col index out of range")); + #endif + return SMatProxy(*this, i, j); + } + + // output ------------------------------------------------------- + /// Dump only non-zero values, with indexes (i,value) + std::string dump(const int p=3, bool dosci=false) const + { + std::ostringstream oss; + size_t i; + oss << "dim(" << nrows << "," << ncols << "), size " << size() + << ", datasize " << datasize() << " :"; + oss << (dosci ? std::scientific : std::fixed) << std::setprecision(p); + + // loop over rows + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = rowsMap.begin(); + if(it == rowsMap.end()) { oss << " empty"; return oss.str(); } + + for( ; it != rowsMap.end(); ++it) { + oss << "\n row " << it->first << ": " << it->second.dump(p,dosci); + } + + return oss.str(); + } + + /// Convert to "dump-able" form : 3 parallel vectors; rows, cols, values + void flatten(std::vector& rows, + std::vector& cols, + std::vector& values) + const + { + rows.clear(); cols.clear(); values.clear(); + + // loop over rows, then columns + typename std::map< unsigned int, SparseVector >::const_iterator it; + typename std::map::const_iterator jt; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + unsigned int row(it->first); + for(jt = it->second.vecMap.begin(); jt != it->second.vecMap.end(); ++jt) { + rows.push_back(row); + cols.push_back(jt->first); + values.push_back(jt->second); + } + } + } + + /// Minimum element - return 0 if empty + // arithmetic and other operators + SparseMatrix& operator-=(const SparseMatrix& SM); + SparseMatrix& operator-=(const Matrix& SM); + SparseMatrix& operator+=(const SparseMatrix& SM); + SparseMatrix& operator+=(const Matrix& SM); + SparseMatrix& operator*=(const T& value); + SparseMatrix& operator/=(const T& value) throw(Exception); + + // unary minus + SparseMatrix operator-() const + { + SparseMatrix toRet(*this); + typename std::map< unsigned int, SparseVector >::iterator it; + typename std::map::iterator jt; + for(it = toRet.rowsMap.begin(); it != toRet.rowsMap.end(); ++it) { + for(jt = it->second.vecMap.begin(); jt != it->second.vecMap.end(); ++jt) + jt->second = -jt->second; + } + return toRet; + } + + /// return row i of this SparseMatrix as a SparseVector + SparseVector rowCopy(const unsigned int i) const; + + /// return col j of this SparseMatrix as a SparseVector + SparseVector colCopy(const unsigned int j) const; + + /// return diagonal of this SparseMatrix as a SparseVector + SparseVector diagCopy(void) const; + + /// swap rows of this SparseMatrix + void swapRows(const unsigned int& ii, const unsigned int& jj); + + /// swap columns of this SparseMatrix + void swapCols(const unsigned int ii, const unsigned int jj); + + private: + /// dimensions of the "real" matrix (not the number of data stored) + unsigned int nrows, ncols; + + /// map of row index, row SparseVector + std::map< unsigned int, SparseVector > rowsMap; + + // TD ? obsolete this by always using transpose when you must loop over columns + /// private function to build a "column map" for this matrix, + /// containing vectors (of row-indexes) for each column. + /// colMap[column index] = vector of all row indexes, in ascending order + std::map< unsigned int, std::vector > columnMap(void) const + { + unsigned int j,k; + typename std::map< unsigned int, SparseVector >::const_iterator it; + typename std::map< unsigned int, std::vector > colMap; + typename std::map< unsigned int, std::vector >::iterator jt; + + // loop over rows, then columns + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + + // get all the column indexes for this row + std::vector colIndexes = it->second.getIndexes(); + + // loop over columns, adding each to the colMap + for(k=0; k jvec; + colMap[j] = jvec; + jt = colMap.find(j); + } + jt->second.push_back(it->first); // add row index to this col-vector + } + } + + //std::ostringstream oss; + //for(jt=colMap.begin(); jt!=colMap.end(); ++jt) { + // oss << " col " << jt->first << " ["; + // for(k=0; ksecond.size(); k++) + // oss << " " << jt->second[k]; + // oss << "]\n"; + //} + //std::cout << "Column map:\n" << oss.str(); + + return colMap; + } + + }; // end class SparseMatrix + + + //--------------------------------------------------------------------------- + // implementation of SparseMatrix + //--------------------------------------------------------------------------- + // submatrix constructor + template SparseMatrix::SparseMatrix(const SparseMatrix& SM, + const unsigned int& rind, const unsigned int& cind, + const unsigned int& rnum, const unsigned int& cnum) + { + if(rnum == 0 || cnum == 0 || rind+rnum > SM.nrows || cind+cnum > SM.ncols) + GPSTK_THROW(Exception("Invalid input submatrix c'tor - out of range")); + + nrows = rnum; + ncols = cnum; + typename std::map< unsigned int, SparseVector >::const_iterator it; + for(it = SM.rowsMap.begin(); it != SM.rowsMap.end(); ++it) { + if(it->first < rind) continue; // skip rows before rind + if(it->first > rind+rnum) break; // done with rows + SparseVector SV(it->second,cind,cnum); // get sub-vector + if(!SV.isEmpty()) rowsMap[it->first] = SV; // add it + } + } + + // constructor from regular Matrix + template SparseMatrix::SparseMatrix(const Matrix& M) + { + unsigned i,j; + nrows = M.rows(); + ncols = M.cols(); + for(i=0; i SVrow(ncols); // 'real' length ncols + rowsMap[i] = SVrow; + haverow = true; + } + rowsMap[i].vecMap[j] = M(i,j); + } + } + } + + /// cast to Matrix + template SparseMatrix::operator Matrix() const + { + Matrix toRet(nrows,ncols,T(0)); + typename std::map< unsigned int, SparseVector >::const_iterator it; + typename std::map< unsigned int, T >::const_iterator jt; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + for(jt = it->second.vecMap.begin(); jt != it->second.vecMap.end(); ++jt) { + toRet(it->first,jt->first) = jt->second; + } + } + + return toRet; + } + + /// zeroize - remove elements that are less than tolerance in abs value + template void SparseMatrix::zeroize(const T tol) + { + std::vector toDelete; // row indexes + typename std::map< unsigned int, SparseVector >::iterator it; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + it->second.zeroize(tol); + + // remove row if its empty - but not inside the iteration loop + if(it->second.datasize() == 0) + toDelete.push_back(it->first); + } + + // now remove the marked rows + for(unsigned int i=0; i SparseMatrix transpose(const SparseMatrix& M) + { + SparseMatrix toRet(M.cols(),M.rows()); + + // loop over rows of M = columns of toRet - faster + typename std::map< unsigned int, SparseVector >::const_iterator it; + typename std::map< unsigned int, SparseVector >::iterator jt; + for(it = M.rowsMap.begin(); it != M.rowsMap.end(); ++it) { + for(unsigned int j=0; jsecond.isFilled(j)) { // M(i,j) + jt = toRet.rowsMap.find(j); + if(jt == toRet.rowsMap.end()) { // add the row + SparseVector rowSV(M.rows()); + toRet.rowsMap[j] = rowSV; + jt = toRet.rowsMap.find(j); + } + jt->second.vecMap[it->first] = it->second[j]; + } + } + } + + return toRet; + } + + /// Maximum element - return 0 if empty + template T min(const SparseMatrix& SM) + { + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = SM.rowsMap.begin(); + if(it == SM.rowsMap.end()) return T(0); + + T value(min(it->second)); // first non-zero row + for(++it ; it != SM.rowsMap.end(); ++it ) { // other rows + T rowval(min(it->second)); + if(rowval < value) value = rowval; + } + + return value; + } + + /// Maximum element - return 0 if empty + template T max(const SparseMatrix& SM) + { + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = SM.rowsMap.begin(); + if(it == SM.rowsMap.end()) return T(0); + + T value(max(it->second)); // first non-zero row + for(++it ; it != SM.rowsMap.end(); ++it ) { // other rows + T rowval(max(it->second)); + if(rowval > value) value = rowval; + } + + return value; + } + + /// Minimum absolute value - return 0 if empty + template T minabs(const SparseMatrix& SM) + { + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = SM.rowsMap.begin(); + if(it == SM.rowsMap.end()) return T(0); + + T value(minabs(it->second)); // first non-zero row + for(++it ; it != SM.rowsMap.end(); ++it ) { // other rows + T rowval(minabs(it->second)); + if(rowval < value) value = rowval; + } + + return value; + } + + /// Maximum absolute value - return 0 if empty + template T maxabs(const SparseMatrix& SM) + { + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = SM.rowsMap.begin(); + if(it == SM.rowsMap.end()) return T(0); + + T value(maxabs(it->second)); // first non-zero row + for(++it ; it != SM.rowsMap.end(); ++it ) { // other rows + T rowval(maxabs(it->second)); + if(rowval > value) value = rowval; + } + + return value; + } + + //--------------------------------------------------------------------------------- + /// stream output operator + template + std::ostream& operator<<(std::ostream& os, const SparseMatrix& SM) + { + std::ofstream savefmt; + savefmt.copyfmt(os); + + unsigned int i, j; // the "real" vector row and column index + typename std::map< unsigned int, SparseVector >::const_iterator it; + + it = SM.rowsMap.begin(); + //if(it == SM.rowsMap.end()) { os << "empty"; return os; } + + for(i=0; ifirst) { + os << std::setw(1) << ' '; os.copyfmt(savefmt); + os << it->second; // write the whole row + ++it; + } + else { + for(j=0; j + SparseVector operator*(const SparseMatrix& L, const SparseVector& V) + { + try { + if(L.cols() != V.size()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SM,SV)")); + + SparseVector retSV(L.rows()); + typename std::map< unsigned int, SparseVector >::const_iterator it; + + // loop over rows of L = rows of answer + for(it = L.rowsMap.begin(); it != L.rowsMap.end(); ++it) + retSV.vecMap[it->first] = dot(it->second,V); + + retSV.zeroize(T(0)); + return retSV; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Matrix,Vector multiply: SparseVector = Matrix * SparseVector + template + SparseVector operator*(const Matrix& L, const SparseVector& V) + { + try { + if(L.cols() != V.size()) + GPSTK_THROW(Exception("Incompatible dimensions op*(M,SV)")); + + SparseVector retSV(L.rows()); + + // loop over rows of L = rows of answer + for(unsigned int i=0; i::const_iterator it; + for(it = V.vecMap.begin(); it != V.vecMap.end(); ++it) + sum += L(i,it->first) * it->second; + retSV.vecMap[i] = sum; + } + + retSV.zeroize(T(0)); + return retSV; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Matrix,Vector multiply: SparseVector = SparseMatrix * Vector + template + SparseVector operator*(const SparseMatrix& L, const Vector& V) + { + try { + if(L.cols() != V.size()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SM,V)")); + + SparseVector retSV(L.rows()); + typename std::map< unsigned int, SparseVector >::const_iterator it; + + // loop over rows of L = rows of answer + for(it = L.rowsMap.begin(); it != L.rowsMap.end(); ++it) + retSV.vecMap[it->first] = dot(it->second,V); + + retSV.zeroize(T(0)); + return retSV; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Vector,Matrix multiply: SparseVector = SparseVector * SparseMatrix + template + SparseVector operator*(const SparseVector& V, const SparseMatrix& R) + { + if(V.size() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SV,SM)")); + + SparseVector retSV(R.cols()); + + // first build a "column map" for R - vectors (of row-index) for each column + // colMap[column index] = vector of all row indexes, in ascending order + std::map< unsigned int, std::vector >::iterator jt; + std::map< unsigned int, std::vector > colMap = R.columnMap(); + + // loop over columns of R = elements of answer + for(jt = colMap.begin(); jt != colMap.end(); ++jt) { + T sum(0); + // loop over rows of R and elements of V + for(unsigned int k=0; ksecond.size(); k++) + if(V.isFilled(jt->second[k])) + sum += V[jt->second[k]] * R(k,jt->first); + if(sum != T(0)) retSV.vecMap[jt->first] = sum; + } + + return retSV; + } + + /// Vector,Matrix multiply: SparseVector = SparseVector * Matrix + template + SparseVector operator*(const SparseVector& V, const Matrix& R) + { + try { + if(V.size() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SV,M)")); + + T sum; + SparseVector retSV(R.cols()); + + // loop over columns of R = elements of answer + for(unsigned int j=0; j colR = R.colCopy(j); + sum = dot(colR,V); + if(sum != T(0)) retSV.vecMap[j] = sum; + } + + return retSV; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Vector,Matrix multiply: SparseVector = Vector * SparseMatrix + template + SparseVector operator*(const Vector& V, const SparseMatrix& R) + { + if(V.size() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(V,SM)")); + + SparseVector retSV(R.cols()); + + // first build a "column map" for R - vectors (of row-index) for each column + // colMap[column index] = vector of all row indexes, in ascending order + std::map< unsigned int, std::vector >::iterator jt; + std::map< unsigned int, std::vector > colMap = R.columnMap(); + + // loop over columns of R = elements of answer + for(jt = colMap.begin(); jt != colMap.end(); ++jt) { + T sum(0); + // loop over rows of R and elements of V + for(unsigned int k=0; ksecond.size(); k++) + sum += V[jt->second[k]] * R(jt->second[k],jt->first); + if(sum != T(0)) retSV.vecMap[jt->first] = sum; + } + + return retSV; + } + + /// Matrix multiply: SparseMatrix = SparseMatrix * SparseMatrix + template + SparseMatrix operator*(const SparseMatrix& L, const SparseMatrix& R) + { + if(L.cols() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SM,SM)")); + + const unsigned int nr(L.rows()), nc(R.cols()); + SparseMatrix retSM(nr,nc); // empty but with correct dimen. + const SparseMatrix RT(transpose(R)); // work with transpose + typename std::map< unsigned int, SparseVector >::const_iterator it, jt; + + // loop over rows of L = rows of retSM + for(it = L.rowsMap.begin(); it != L.rowsMap.end(); ++it) { + bool haveRow(false); // use to create the row + // loop over rows of RT == columns of R + for(jt = RT.rowsMap.begin(); jt != RT.rowsMap.end(); ++jt) { + // answer(i,j) = dot product of Lrow and RTrow==Rcol + T d(dot(it->second,jt->second)); + if(d != T(0)) { + if(!haveRow) { + SparseVector row(nc); + retSM.rowsMap[it->first] = row; + haveRow = true; + } + retSM.rowsMap[it->first].vecMap[jt->first] = d; + } + } + } + + return retSM; + } + + /// Matrix multiply: SparseMatrix = SparseMatrix * Matrix + template + SparseMatrix operator*(const SparseMatrix& L, const Matrix& R) + { + try { + if(L.cols() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(SM,M)")); + + const unsigned int nr(L.rows()), nc(R.cols()); + SparseMatrix retSM(nr,nc); + typename std::map< unsigned int, SparseVector >::const_iterator it; + + // loop over rows of L = rows of answer + for(it = L.rowsMap.begin(); it != L.rowsMap.end(); ++it) { + bool haveRow(false); // use to create the row + // loop over columns of R = cols of answer + for(unsigned int j=0; j colR(R.colCopy(j)); + T d(dot(it->second,colR)); + if(d != T(0)) { + if(!haveRow) { + SparseVector row(nc); + retSM.rowsMap[it->first] = row; + haveRow = true; + } + retSM.rowsMap[it->first].vecMap[j] = d; + } + } + } + + return retSM; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Matrix multiply: SparseMatrix = Matrix * SparseMatrix + template + SparseMatrix operator*(const Matrix& L, const SparseMatrix& R) + { + if(L.cols() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op*(M,SM)")); + + const unsigned int nr(L.rows()), nc(R.cols()); + SparseMatrix retSM(nr,nc); + const SparseMatrix RT(transpose(R)); // work with transpose + typename std::map< unsigned int, SparseVector >::const_iterator jt; + + // loop over rows of L = rows of retSM + for(unsigned int i=0; i < nr; i++) { + bool haveRow(false); // use to create the row in retSM + const Vector rowL(L.rowCopy(i)); // copy out the row in L + + // loop over rows of RT == columns of R + for(jt = RT.rowsMap.begin(); jt != RT.rowsMap.end(); ++jt) { + // answer(i,j) = dot product of Lrow and RTrow==Rcol + T d(dot(rowL,jt->second)); + if(d != T(0)) { + if(!haveRow) { + SparseVector row(nc); + retSM.rowsMap[i] = row; + haveRow = true; + } + retSM.rowsMap[i].vecMap[jt->first] = d; + } + } + } + + return retSM; + } + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + /// Concatenation SparseMatrix || Vector TD the rest of them... + template + SparseMatrix operator||(const SparseMatrix& L, const Vector& V) + { + if(L.rows() != V.size()) + GPSTK_THROW(Exception("Incompatible dimensions op||(SM,V)")); + + SparseMatrix toRet(L); + toRet.ncols++; + + unsigned int i,n(toRet.ncols-1); + typename std::map< unsigned int, SparseVector >::iterator jt; + for(i=0; i V(toRet.ncols); + toRet.rowsMap[i] = V; + } + toRet.rowsMap[i].vecMap[n] = V(i); + } + } + return toRet; + } + + //--------------------------------------------------------------------------- + template + SparseMatrix operator||(const SparseMatrix& L, const SparseMatrix& R) + { + if(L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op||(SM,SM)")); + + SparseMatrix toRet(L); + toRet.ncols += R.ncols; + + unsigned int i, N(L.ncols); + typename std::map< unsigned int, SparseVector >::iterator it; + typename std::map< unsigned int, SparseVector >::const_iterator jt; + it = toRet.rowsMap.begin(); + jt = R.rowsMap.begin(); + while(it != toRet.rowsMap.end() && jt != R.rowsMap.end()) { + if(it->first < jt->first) { // R has no row here - do nothing + it->second.len += N; + ++it; + } + else if(it->first > jt->first) { // R has a row where toRet does not + toRet.rowsMap[jt->first] = jt->second; + toRet.rowsMap[jt->first].len += N; + ++jt; + } + else { // equal indexes - both have rows + it->second.len += N; + typename std::map< unsigned int, T >::const_iterator vt; + for(vt = jt->second.vecMap.begin(); vt != jt->second.vecMap.end(); ++vt) { + toRet.rowsMap[it->first].vecMap[N+vt->first] = vt->second; + } + ++it; + ++jt; + } + } + + return toRet; + } + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + /// Matrix subtraction: SparseMatrix -= SparseMatrix + template + SparseMatrix& SparseMatrix::operator-=(const SparseMatrix& SM) + { + if(SM.cols() != cols() || SM.rows() != rows()) + GPSTK_THROW(Exception("Incompatible dimensions op-=(SM)")); + //std::cout << "SM::op-=(SM)" << std::endl; + + // loop over rows of SM + typename std::map< unsigned int, SparseVector >::const_iterator sit; + for(sit = SM.rowsMap.begin(); sit != SM.rowsMap.end(); ++sit) { + // find same row in this + if(rowsMap.find(sit->first) == rowsMap.end()) + rowsMap[sit->first] = -sit->second; + else + rowsMap[sit->first] -= sit->second; + } + + zeroize(T(0)); + return *this; + } + + /// Matrix subtraction: SparseMatrix -= Matrix + template + SparseMatrix& SparseMatrix::operator-=(const Matrix& M) + { + if(M.cols() != cols() || M.rows() != rows()) + GPSTK_THROW(Exception("Incompatible dimensions op-=(M)")); + //std::cout << "SM::op-=(M)" << std::endl; + + // loop over rows of M + for(unsigned int i=0; i rowV(M.rowCopy(i)); + if(rowsMap.find(i) == rowsMap.end()) { + SparseVector SV(rowV); + rowsMap[i] = -SV; + } + else + rowsMap[i] -= rowV; + } + + zeroize(T(0)); + return *this; + } + + /// Matrix subtraction: SparseMatrix = SparseMatrix - SparseMatrix + template + SparseMatrix operator-(const SparseMatrix& L, const SparseMatrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op-(SM,SM)")); + //std::cout << "SM::op-(SM,SM)" << std::endl; + + SparseMatrix retSM(L); + retSM -= R; // will zeroize(T(0)) + + return retSM; + } + + /// Matrix subtraction: SparseMatrix = SparseMatrix - Matrix + template + SparseMatrix operator-(const SparseMatrix& L, const Matrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op-(SM,M)")); + //std::cout << "SM::op-(SM,M)" << std::endl; + + SparseMatrix retSM(L); + retSM -= R; // will zeroize(T(0)) + + return retSM; + } + + /// Matrix subtraction: SparseMatrix = Matrix - SparseMatrix + template + SparseMatrix operator-(const Matrix& L, const SparseMatrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op-(M,SM)")); + //std::cout << "SM::op-(M,SM)" << std::endl; + + SparseMatrix retSM(R); + retSM = -retSM; + retSM += L; // will zeroize(T(0)) + + return retSM; + } + + //--------------------------------------------------------------------------- + /// Matrix addition: SparseMatrix += SparseMatrix + template + SparseMatrix& SparseMatrix::operator+=(const SparseMatrix& SM) + { + if(SM.cols() != cols() || SM.rows() != rows()) + GPSTK_THROW(Exception("Incompatible dimensions op+=(SM)")); + //std::cout << "SM::op+=(SM)" << std::endl; + + // loop over rows of SM + typename std::map< unsigned int, SparseVector >::const_iterator sit; + for(sit = SM.rowsMap.begin(); sit != SM.rowsMap.end(); ++sit) { + // find same row in this + if(rowsMap.find(sit->first) == rowsMap.end()) + rowsMap[sit->first] = sit->second; + else + rowsMap[sit->first] += sit->second; + } + + zeroize(T(0)); + return *this; + } + + /// Matrix addition: SparseMatrix += Matrix + template + SparseMatrix& SparseMatrix::operator+=(const Matrix& M) + { + if(M.cols() != cols() || M.rows() != rows()) + GPSTK_THROW(Exception("Incompatible dimensions op+=(M)")); + //std::cout << "SM::op+=(M)" << std::endl; + + // loop over rows of M + for(unsigned int i=0; i rowV(M.rowCopy(i)); + if(rowsMap.find(i) == rowsMap.end()) { + SparseVector SV(rowV); + rowsMap[i] = SV; + } + else + rowsMap[i] += rowV; + } + + zeroize(T(0)); + return *this; + } + + //--------------------------------------------------------------------------- + /// Multiply all elements by a scalar T constant + template + SparseMatrix& SparseMatrix::operator*=(const T& value) + { + if(value == T(0)) { + rowsMap.clear(); + return *this; + } + + // loop over all elements + typename std::map< unsigned int, SparseVector >::iterator it; + typename std::map< unsigned int, T >::iterator vt; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + for(vt = it->second.vecMap.begin(); vt != it->second.vecMap.end(); ++vt) + vt->second *= value; + } + + return *this; + } + + /// Divide all elements by a scalar T constant + /// @throw if the constant is zero + template + SparseMatrix& SparseMatrix::operator/=(const T& value) throw(Exception) + { + if(value == T(0)) GPSTK_THROW(Exception("Divide by zero")); + + // loop over all elements + typename std::map< unsigned int, SparseVector >::iterator it; + typename std::map< unsigned int, T >::iterator vt; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { + for(vt = it->second.vecMap.begin(); vt != it->second.vecMap.end(); ++vt) + vt->second /= value; + } + + return *this; + } + + /// Matrix addition: SparseMatrix = SparseMatrix + SparseMatrix : copy, += SM + template + SparseMatrix operator+(const SparseMatrix& L, const SparseMatrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op+(SM,SM)")); + //std::cout << "SM::op+(SM,SM)" << std::endl; + + SparseMatrix retSM(L); + retSM -= R; // will zeroize(T(0)) + + return retSM; + } + + /// Matrix addition: SparseMatrix = SparseMatrix + Matrix : copy, += M + template + SparseMatrix operator+(const SparseMatrix& L, const Matrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op+(SM,M)")); + //std::cout << "SM::op+(SM,M)" << std::endl; + + SparseMatrix retSM(L); + retSM -= R; // will zeroize(T(0)) + + return retSM; + } + + /// Matrix addition: SparseMatrix = Matrix + SparseMatrix : copy, += M in rev order + template + SparseMatrix operator+(const Matrix& L, const SparseMatrix& R) + { + if(L.cols() != R.cols() || L.rows() != R.rows()) + GPSTK_THROW(Exception("Incompatible dimensions op+(M,SM)")); + //std::cout << "SM::op+(M,SM)" << std::endl; + + SparseMatrix retSM(L); + retSM -= R; // will zeroize(T(0)) + + return retSM; + } + + //--------------------------------------------------------------------------- + // row, col and diagonal copy, swap + //--------------------------------------------------------------------------- + /// return row i of this SparseMatrix as a SparseVector + template + SparseVector SparseMatrix::rowCopy(const unsigned int i) const + { + SparseVector retSV; + typename std::map< unsigned int, SparseVector >::const_iterator it; + it = rowsMap.find(i); + if(it != rowsMap.end()) + retSV = it->second; + return retSV; + } + + /// return col j of this SparseMatrix as a SparseVector + template + SparseVector SparseMatrix::colCopy(const unsigned int j) const + { + SparseVector retSV; + + typename std::map< unsigned int, SparseVector >::const_iterator it; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { // loop over rows + if(it->second.isFilled(j)) + retSV.vecMap[it->first] = it->second[j]; + } + retSV.len = rows(); + + return retSV; + } + + /// return diagonal of this SparseMatrix as a SparseVector + template + SparseVector SparseMatrix::diagCopy(void) const + { + SparseVector retSV; + + typename std::map< unsigned int, SparseVector >::const_iterator it; + for(it = rowsMap.begin(); it != rowsMap.end(); ++it) { // loop over rows + if(it->second.isFilled(it->first)) + retSV.vecMap[it->first] = it->second[it->first]; + } + retSV.len = rows(); + + return retSV; + } + + /// swap rows of this SparseMatrix + template + void SparseMatrix::swapRows(const unsigned int& ii, const unsigned int& jj) + { + if(ii >= nrows || jj >= nrows) GPSTK_THROW(Exception("Invalid indexes")); + + typename std::map< unsigned int, SparseVector >::iterator it, jt; + it = rowsMap.find(ii); + jt = rowsMap.find(jj); + if(it == rowsMap.end()) { + if(jt == rowsMap.end()) return; // nothing to do + else { + rowsMap[ii] = rowsMap[jj]; + rowsMap.erase(jt); + } + } + else { + if(jt == rowsMap.end()) { + rowsMap[jj] = rowsMap[ii]; + rowsMap.erase(it); + } + else { + SparseVector save(it->second); + rowsMap[ii] = rowsMap[jj]; + rowsMap[jj] = save; + } + } + } + + /// swap columns of this SparseMatrix + template + void SparseMatrix::swapCols(const unsigned int ii, const unsigned int jj) + { + if(ii >= ncols || jj >= ncols) GPSTK_THROW(Exception("Invalid indexes")); + + // may not be the fastest, but may be fast enough - tranpose() is fast + SparseMatrix trans(transpose(*this)); + trans.swapRows(ii,jj); + *this = transpose(*this); + } + + //--------------------------------------------------------------------------------- + // special matrices + //--------------------------------------------------------------------------------- + /// Compute the identity matrix of dimension dim x dim + /// @param dim dimension of desired identity matrix (dim x dim) + /// @return identity matrix + template + SparseMatrix identSparse(const unsigned int dim) throw() + { + if(dim == 0) return SparseMatrix(); + + SparseMatrix toRet(dim,dim); + for(unsigned int i=0; i SV(dim); + SV.vecMap[i] = T(1); + toRet.rowsMap[i] = SV; + } + + return toRet; + } + + //--------------------------------------------------------------------------------- + // matrix products and transformations + //--------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------- + // SM * transpose(SM) + // NB this is barely faster than just forming SM * transpose(SM) + template + SparseMatrix matrixTimesTranspose(const SparseMatrix& SM) throw(Exception) + { + try { + SparseMatrix toRet(SM.rows(),SM.rows()); + + typename std::map< unsigned int, SparseVector >::const_iterator it, jt; + for(it = SM.rowsMap.begin(); it != SM.rowsMap.end(); ++it) { + SparseVector Vrow(SM.rows()); + toRet.rowsMap[it->first] = Vrow; + for(jt = SM.rowsMap.begin(); jt != SM.rowsMap.end(); ++jt) { + T d(dot(it->second,jt->second)); + if(d != T(0)) toRet.rowsMap[it->first][jt->first] = d; + } + } + + return toRet; + + } catch(Exception& e) { GPSTK_RETHROW(e); } + } + + //--------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------- + /// Compute diagonal of P*C*P^T, ie diagonal of transform of square Matrix C. + template + Vector transformDiag(const SparseMatrix& P, const Matrix& C) + throw(Exception) + { + try { + if(P.cols() != C.rows() || C.rows() != C.cols()) + GPSTK_THROW(Exception("Incompatible dimensions transformDiag()")); + + const unsigned int n(P.cols()); + typename std::map< unsigned int, SparseVector >::const_iterator jt; + typename std::map< unsigned int, T >::const_iterator vt; + + Vector toRet(P.rows(),T(0)); + T sum; + + // loop over rows of P = columns of transpose(P) + for(jt = P.rowsMap.begin(); jt != P.rowsMap.end(); ++jt) { + unsigned int j = jt->first; // row of P, col of P^T + Vector prod(n,T(0)); + + // loop over columns of C up to and including j, + // forming dot product prod(k) = P(rowj) * C(colk) + for(unsigned int k=0; ksecond.vecMap.begin(); vt!=jt->second.vecMap.end(); ++vt) + sum += vt->second * C(vt->first,k); + if(sum != T(0)) prod(k) = sum; + } + toRet(j) = dot(jt->second,prod); + } + return toRet; + + } catch(Exception& e) { GPSTK_RETHROW(e); } + } + + //--------------------------------------------------------------------------- + // inverse (via Gauss-Jordan) + //--------------------------------------------------------------------------- + /// inverse via Gauss-Jordan; NB GJ involves only row operations. + /// NB not the best numerically; for high condition number, use inverseViaCholesky, + /// or cast to Matrix, use either LUD or SVD, then cast back to SparseMatrix. + template + SparseMatrix inverse(const SparseMatrix& A) throw(Exception) + { + try { + if(A.rows() != A.cols() || A.rows() == 0) { + std::ostringstream oss; + oss << "Invalid input dimensions: " << A.rows() << "x" << A.cols(); + GPSTK_THROW(Exception(oss.str())); + } + + unsigned int i,k; + T dtmp; + //T big, small; + typename std::map< unsigned int, SparseVector >::const_iterator it; + + // does A have any zero rows? + for(it = A.rowsMap.begin(), i=0; it != A.rowsMap.end(); i++, ++it) { + if(i != it->first) { + std::ostringstream oss; + oss << "Singular matrix - zero row at index " << i << ")"; + GPSTK_THROW(Exception(oss.str())); + } + } + + const unsigned int N(A.rows()); + typename std::map< unsigned int, SparseVector >::iterator jt,kt; + typename std::map< unsigned int, T >::iterator vt; + SparseMatrix GJ(A || identSparse(N)); + + //std::cout << "\nInitial:\n" << std::scientific + // << std::setprecision(2) << std::setw(10) << GJ << std::endl; + + // loop over rows of work matrix, making lower left triangular = unity + for(jt = GJ.rowsMap.begin(); jt != GJ.rowsMap.end(); ++jt) { + + // divide row by diagonal element; if diagonal is zero, add another row + vt = jt->second.vecMap.find(jt->first); // diagonal element GJ(j,j) + if(vt == jt->second.vecMap.end() || vt->second == T(0)) { + // find a lower row with non-zero element (same col); add to this row + for((kt=jt)++; kt != GJ.rowsMap.end(); ++kt) { + vt = kt->second.vecMap.find(jt->first); // GJ(k,j) + if(vt == kt->second.vecMap.end() || vt->second == T(0)) + continue; // nope, its zero + + // add the kt row to the jt row + jt->second += kt->second; + break; + } + if(kt == GJ.rowsMap.end()) + GPSTK_THROW(Exception("Singular matrix")); + } + + dtmp = vt->second; + // are these scales 1/dtmp related to condition number? eigenvalues? det? + // they are close to condition number.... + //if(jt == GJ.rowsMap.begin()) big = small = ::fabs(dtmp); + //if(::fabs(dtmp) > big) big = ::fabs(dtmp); + //if(::fabs(dtmp) < small) small = ::fabs(dtmp); + + // normalize the j row + if(dtmp != T(1)) jt->second *= T(1)/dtmp; + + //std::cout << "\nRow " << jt->first << " scaled with " << std::scientific + // << std::setprecision(2) << T(1)/dtmp << "\n" + // << std::setw(10) << GJ << std::endl; + + // now zero out the column below the j diagonal + for((kt=jt)++; kt != GJ.rowsMap.end(); ++kt) { + vt = kt->second.vecMap.find(jt->first); // GJ(k,j) + if(vt == kt->second.vecMap.end() || vt->second == T(0)) + continue; // already zero + + kt->second.addScaledSparseVector(-vt->second, jt->second); + } + + //std::cout << "\nRow " << jt->first << " left-zeroed:\n" + // << std::scientific << std::setprecision(2) << std::setw(10) + // << GJ << std::endl; + } + + // loop over rows of work matrix in reverse order, + // zero-ing out the column above the diag + typename std::map< unsigned int, SparseVector >::reverse_iterator rjt,rkt; + for(rjt = GJ.rowsMap.rbegin(); rjt != GJ.rowsMap.rend(); ++rjt) { + // now zero out the column above the j diagonal + for((rkt=rjt)++; rkt != GJ.rowsMap.rend(); ++rkt) { + vt = rkt->second.vecMap.find(rjt->first); // GJ(k,j) + if(vt == rkt->second.vecMap.end() || vt->second == T(0)) + continue; // already zero + rkt->second.addScaledSparseVector(-vt->second, rjt->second); + } + + //std::cout << "\nRow " << rjt->first << " right-zeroed:\n" + // << std::scientific << std::setprecision(2) << std::setw(10) + // << GJ << std::endl; + } + + //std::cout << "\nbig and small for this matrix are: " + // << std::scientific << std::setprecision(2) + // << big << " " << small << " with ratio " << big/small << std::endl; + + return (SparseMatrix(GJ,0,N,N,N)); + + } catch(Exception& e) { GPSTK_RETHROW(e); } + } + + //--------------------------------------------------------------------------- + // Factorization, decomposition and other algorithms + //--------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------- + // Compute Cholesky decomposition of symmetric positive definite matrix using Crout + // algorithm. A = L*L^T where A and L are (nxn) and L is lower triangular reads: + // [ A00 A01 A02 ... A0n ] = [ L00 0 0 0 ... 0 ][ L00 L10 L20 ... L0n ] + // [ A10 A11 A12 ... A1n ] = [ L10 L11 0 0 ... 0 ][ 0 L11 L21 ... L1n ] + // [ A20 A21 A22 ... A2n ] = [ L20 L21 L22 0 ... 0 ][ 0 0 L22 ... L2n ] + // ... ... ... + // [ An0 An1 An2 ... Ann ] = [ Ln0 Ln1 Ln2 0 ... Lnn][ 0 0 0 ... Lnn ] + // but multiplying out gives + // A = [ L00^2 + // [ L00*L10 L11^2+L10^2 + // [ L00*L20 L11*L21+L10*L20 L22^2+L21^2+L20^2 + // ... + // Aii = Lii^2 + sum(k=0,i-1) Lik^2 + // Aij = Lij*Ljj + sum(k=0,j-1) Lik*Ljk + // These can be inverted by looping over columns, and filling L from diagonal down. + // So fill L in this way + // d do diagonal element first, then the column below it + // 1d at each row i below the diagonal, save the element^2 in rowSums[i] + // 12d + // 123d + // 123 d + // 123 d + // 123 d + // 123 d + // 123 etc d + + /// Compute lower triangular square root of a symmetric positive definite matrix + /// (Cholesky decomposition) Crout algorithm. + /// @param A SparseMatrix to be decomposed; symmetric and positive definite, const + /// @return SparseMatrix lower triangular square root of input matrix + /// @throw if input SparseMatrix is not square + /// @throw if input SparseMatrix is not positive definite + template + SparseMatrix lowerCholesky(const SparseMatrix& A) throw(Exception) + { + if(A.rows() != A.cols() || A.rows() == 0) { + std::ostringstream oss; + oss << "Invalid input dimensions: " << A.rows() << "x" << A.cols(); + GPSTK_THROW(Exception(oss.str())); + } + + const unsigned int n=A.rows(); + unsigned int i,j,k; + T d, diag; + SparseMatrix L(n,n); // compute the answer + std::vector rowSums; // keep sum(k=0..j-1)[L(j,k)^2] for each row j + typename std::map< unsigned int, SparseVector >::const_iterator it, jt; + typename std::map< unsigned int, SparseVector >::iterator Lit, Ljt; + + // A must have all rows - a zero row in A means its singular + // create all the rows in L; all exist b/c if any diagonal is 0 -> singular + // fill rowSums vector with zeros + for(it=A.rowsMap.begin(), i=0; it!=A.rowsMap.end(); i++, ++it) { + if(i != it->first) { + std::ostringstream oss; + oss << "lowerCholesky() requires positive-definite input:" + << " (zero rows at index " << i << ")"; + GPSTK_THROW(Exception(oss.str())); + } + + SparseVector Vrow(n); + L.rowsMap[i] = Vrow; + + rowSums.push_back(T(0)); + } + + // loop over columns of A, at the same time looping over rows of L + // use jt to iterate over the columns of A, keeping count with (column) j + for(jt = A.rowsMap.begin(), Ljt = L.rowsMap.begin(); + jt != A.rowsMap.end() && Ljt != L.rowsMap.end(); ++jt, ++Ljt) + { + j = jt->first; // column j (A) or row i (L) + + // compute the j,j diagonal element of L + // start with diagonal of A(j,j) + d = jt->second[j]; // A(j,j) + + // subtract sum(k=0..j-1)[L(j,k)^2] + d -= rowSums[j]; + + // d is the eigenvalue - must not be zero + if(d <= T(0)) { + std::ostringstream oss; + oss << "Non-positive eigenvalue " << std::scientific << d << " at col " + << j << ": lowerCholesky() requires positive-definite input"; + GPSTK_THROW(Exception(oss.str())); + } + + diag = SQRT(d); + L.rowsMap[j].vecMap[j] = diag; // L(j,j) + + // now loop over rows below the diagonal, filling in this column + Lit = Ljt; + it = jt; + for(++Lit, ++it; Lit != L.rowsMap.end(); ++Lit, ++it) { + i = Lit->first; + d = (it->second.isFilled(j) ? it->second[j] : T(0)); + d -= dot_lim(Lit->second, Ljt->second, 0, j); + + if(d != T(0)) { + d /= diag; + Lit->second.vecMap[j] = d; + rowSums[i] += d*d; // save L(i,j)^2 term + } + + } // end loop over rows below the diagonal + + } // end loop over column j of A + + return L; + } + + //--------------------------------------------------------------------------------- + /// Compute inverse of lower-triangular SparseMatrix + template + SparseMatrix inverseLT(const SparseMatrix& L, T *ptrSmall, T *ptrBig) + throw(Exception) + { + if(L.rows() != L.cols() || L.rows() == 0) { + std::ostringstream oss; + oss << "Invalid input dimensions: " << L.rows() << "x" << L.cols(); + GPSTK_THROW(Exception(oss.str())); + } + + const unsigned int n(L.rows()); + unsigned int i,j,k; + T big(0), small(0), dum, sum; + + // trick is to fill transpose(inverse) and then transpose at the end + SparseMatrix invLT(L.cols(),L.rows()); + typename std::map< unsigned int, SparseVector >::const_iterator it; + typename std::map< unsigned int, SparseVector >::iterator jt; + + // do the diagonal first; this finds singularities and defines all rows in InvLT + for(i=0, it = L.rowsMap.begin(); i < n; ++it, ++i) { + if(it == L.rowsMap.end() || it->first != i || + !it->second.isFilled(i) || it->second[i]==T(0)) + { + std::ostringstream oss; + oss << "Singular matrix - zero diagonal at row " << i; + GPSTK_THROW(Exception(oss.str())); + } + + dum = it->second[i]; + if(ptrSmall) { + if(ABS(dum) > big) big = ABS(dum); + if(ABS(dum) < small) small = ABS(dum); + } + + // create row i and element i,i in the answer + dum = T(1)/dum; + SparseVector SV(L.cols()); + SV.vecMap[i] = dum; + invLT.rowsMap[i] = SV; + } + + // loop over rows again, filling in below the diagonal + // (L has all rows present, else its singular above) + //for(i=1; isecond[it->first]; // has to be there, and non-zero + // loop over columns of invL (rows of invLT) before the diagonal + // store results temporarily in a map + std::map tempMap; + //for(j=0; jfirst >= it->first) break; + //sum=0; for(k=j;ksecond, jt->second, jt->first, it->first); + //invLT(j,i) = -sum*dum + if(sum != T(0)) tempMap[jt->first] = -dum*sum; + //jt->second.vecMap[it->first] = -dum*sum; + } + // now move contents of tempMap to invLT + typename std::map::iterator tt = tempMap.begin(); + for( ; tt != tempMap.end(); ++tt) + invLT.rowsMap[tt->first].vecMap[it->first] = tt->second; // invLT(j,i) + } + + if(ptrSmall) *ptrSmall = small; + if(ptrBig) *ptrBig = big; + + return transpose(invLT); + } + + //--------------------------------------------------------------------------------- + /// Compute upper triangular square root of a symmetric positive definite matrix + /// (Cholesky decomposition) Crout algorithm; that is A = transpose(U)*U. + /// Note that this result will be equal to + /// transpose(lowerCholesky(A)) == transpose(Ch.L from class Cholesky), NOT Ch.U; + /// class Cholesky computes L,U where A = L*LT = U*UT [while A=UT*U here]. + /// @param A SparseMatrix to be decomposed; symmetric and positive definite, const + /// @return SparseMatrix upper triangular square root of input matrix + /// @throw if input SparseMatrix is not square + /// @throw if input SparseMatrix is not positive definite + template + SparseMatrix upperCholesky(const SparseMatrix& A) throw(Exception) + { return transpose(lowerCholesky(A)); } + + //--------------------------------------------------------------------------------- + /// Compute inverse of a symmetric positive definite matrix using Cholesky + /// decomposition. + /// @param A SparseMatrix to be inverted; symmetric and positive definite, const + /// @return SparseMatrix inverse of input matrix + /// @throw if input SparseMatrix is not square, not positive definite, or singular + template + SparseMatrix inverseViaCholesky(const SparseMatrix& A) throw(Exception) + { + try { + //SparseMatrix L(lowerCholesky(A)); + //SparseMatrix Linv(inverseLT(L)); + //SparseMatrix Ainv(matrixTimesTranspose(transpose(Linv))); + //return Ainv; + return (matrixTimesTranspose(transpose(inverseLT(lowerCholesky(A))))); + } + catch(Exception& me) { + me.addText("Called by inverseViaCholesky()"); + GPSTK_RETHROW(me); + } + } + + //--------------------------------------------------------------------------------- + /// Householder transformation of a matrix. + template + SparseMatrix SparseHouseholder(const SparseMatrix& A) throw(Exception) + { + unsigned int i,j,k; + typename std::map< unsigned int, SparseVector >::iterator jt,kt,it; + typename std::map< unsigned int, T >::iterator vt; + + SparseMatrix AT(transpose(A)); // perform the algorithm on the transpose + + // loop over rows (columns of input A) + for(j=0; (j V(jt->second); + T sum(0); + for(vt=V.vecMap.begin(); vt!=V.vecMap.end(); ++vt) { + if(vt->first < j) continue; + sum += vt->second * vt->second; + } + if(sum < T(1.e-20)) continue; // col j is already zero below diag + + //zero out below diagonal - must remove element + vt = jt->second.vecMap.lower_bound(jt->first); + if(vt != jt->second.vecMap.end()) + jt->second.vecMap.erase(vt,jt->second.vecMap.end()); + + sum = SQRT(sum); + vt = V.vecMap.find(j); + if(vt != V.vecMap.end()) { + if(vt->second > T(0)) sum = -sum; + jt->second[j] = sum; // A(j,j) = sum + vt->second -= sum; // V(j) -= sum + sum = T(1)/(sum*vt->second); + } + else { + jt->second[j] = sum; // A(j,j) = sum + V.vecMap[j] = -sum; // V(j) -= sum + sum = T(-1)/(sum*sum); + } + + // loop over columns beyond j + kt = jt; + for(++kt; kt != AT.rowsMap.end(); ++kt) { + T alpha(0); + for(vt=kt->second.vecMap.begin(); vt!=kt->second.vecMap.end(); ++vt) { + if(vt->first < j) continue; + i = vt->first; + if(V.isFilled(i)) // alpha += A(i,k)*V(i) + alpha += vt->second * V.vecMap[i]; + } + alpha *= sum; + if(alpha == T(0)) continue; + // modify column k at and below j + for(i=jt->first; isecond.vecMap.find(i); + if(vt == kt->second.vecMap.end()) { // create element + kt->second.vecMap[i] = alpha * V.vecMap[i]; + } + else { + kt->second.vecMap[i] += alpha * V.vecMap[i]; + } + } + } + } + + return (transpose(AT)); + } + + //--------------------------------------------------------------------------------- + // This routine uses the Householder algorithm to update the SRI state+covariance. + // Input: + // R a priori SRI matrix (upper triangular, dimension N) + // Z a priori SRI data vector (length N) + // A concatentation of H and D : A = H || D, where + // H Measurement partials, an M by N matrix. + // D Data vector, of length M + // Output: Updated R and Z. H is trashed, but the data vector D + // contains the residuals of fit (D - A*state). + // Return values: SrifMU returns void, but throws exceptions if the input matrices + // or vectors have incompatible dimensions. + // + // Measurment noise associated with H and D must be white with unit covariance. + // If necessary, the data can be 'whitened' before calling this routine in order + // to satisfy this requirement. This is done as follows. + // Compute the lower triangular square root of the covariance matrix, L, + // and replace H with inverse(L)*H and D with inverse(L)*D. + // + // The Householder transformation is simply an orthogonal transformation + // designed to make the elements below the diagonal zero. It works by explicitly + // performing the transformation, one column at a time, without actually + // constructing the transformation matrix. The matrix is transformed as follows + // [ A(m,n) ] => [ sum a ] + // [ ] => [ 0 A'(m-1,n-1) ] + // after which the same transformation is applied to A' matrix, until A' has only + // one row or column. The transformation that zeros the diagonal below the (k,k) + // element also replaces the (k,k) element and modifies the matrix elements for + // columns >= k and rows >=k, but does not affect the matrix for columns < k + // or rows < k. + // Column k (=0..min(m,n)-1) of the input matrix A(m,n) can be zeroed + // below the diagonal (columns < k have already been so zeroed) as follows: + // let y be the vector equal to column k at the diagonal and below, + // ( so y(j)==A(k+j,k), y(0)==A(k,k), y.size = m-k ) + // let sum = -sign(y(0))*|y|, + // define vector u by u(0) = y(0)-sum, u(j)=y(j) for j>0 (j=1..m-k) + // and finally define b = 1/(sum*u(0)). + // Redefine column k with A(k,k)=sum and A(k+j,k)=0, j=1..m, and then for + // each column j > k, (j=k+1..n) + // compute g = b*sum[u(i)*A(k+i,j)], i=0..m-k-1, + // replace A(k+i,j) with A(k+i,j)+g*u(i), for i=0..m-k-1 + // Most algorithms don't handle special cases: + // 1. If column k is already zero below the diagonal, but A(k,k)!=0, then + // y=[A(k,k),0,0,...0], sum=-A(k,k), u(0)=2A(k,k), u=[2A(k,k),0,0,...0] + // and b = -1/(2*A(k,k)^2). Then, zeroing column k only changes the sign + // of A(k,k), and for the other columns j>k, g = -A(k,j)/A(k,k) and only + // row k is changed. + // 2. If column k is already zero below the diagonal, AND A(k,k) is zero, + // then y=0,sum=0,u=0 and b is infinite...the transformation is undefined. + // However this column should be skipped (Biermann Appendix VII.B). + // + // Ref: Bierman, G.J. "Factorization Methods for Discrete Sequential + // Estimation," Academic Press, 1977. + // + /// Square root information measurement update, with new data in the form of a + /// single SparseMatrix concatenation of H and D: A = H || D. + /// See doc for the overloaded SrifMU(). + template + void SrifMU(Matrix& R, Vector& Z, SparseMatrix& A, const unsigned int M) + throw(Exception) + { + // if necessary, create R and Z + if(A.cols() > 1 && R.rows() == 0 && Z.size() == 0) { + R = Matrix(A.cols()-1,A.cols()-1,0.0); + Z = Vector(A.cols()-1,0.0); + } + + if(A.cols() <= 1 || A.cols() != R.cols()+1 || Z.size() < R.rows()) { + std::ostringstream oss; + oss << "Invalid input dimensions:\n R has dimension " + << R.rows() << "x" << R.cols() << ",\n Z has length " + << Z.size() << ",\n and A has dimension " + << A.rows() << "x" << A.cols(); + GPSTK_THROW(Exception(oss.str())); + } + + const T EPS=T(1.e-20); + const unsigned int m(M==0 || M>A.rows() ? A.rows() : M), n(R.rows()); + const unsigned int np1(n+1); // if np1 = n, state vector Z is not updated + unsigned int i,j,k; + T dum, delta, beta; + typename std::map< unsigned int, SparseVector >::iterator jt,kt,it; + typename std::map< unsigned int, T >::iterator vt; + + SparseMatrix AT(transpose(A)); // work with the transpose + + for(j=0; j Vj(jt->second); + T sum(dot(Vj,Vj)); + //T sum(0); + //for(i=0; i T(0) ? -T(1) : T(1)) * SQRT(sum); + delta = dum - sum; + R(j,j) = sum; + + //if(j+1 > np1) break; // this in case np1 is ever set to n .... + + beta = sum*delta; // beta by construction must be negative + if(beta > -EPS) continue; + beta = T(1)/beta; + + kt = jt; + for(k=j+1; k Vk(m); // will be column k of A + + if(kt->first == k-1) ++kt; // kt now points to next column -- is it k? + if(kt->first != k) { // no col k - should create a column in A... + AT.rowsMap[k] = Vk; + kt = AT.rowsMap.find(k); + } + else + Vk = kt->second; // now Vk is column k of A, perhaps empty + + sum = delta * (k==n ? Z(j) : R(j,k)); + sum += dot(Vk,Vj); + // for(i=0; isecond.vecMap.begin(); + for(i=0; isecond.vecMap.end() && vt->first == i) { + vt->second += sum * Vj.vecMap[i]; + ++vt; + } + else + kt->second.vecMap[i] = sum * Vj.vecMap[i]; + } + } + } + + // must put last row of AT (last column of A) back into A - these are residuals + jt = AT.rowsMap.find(AT.rows()-1); + // should never happen + if(jt == AT.rowsMap.end()) GPSTK_THROW(Exception("Failure on last column")); + + // put this row, jt->second, into the last column of A + j = A.cols()-1; + i = 0; + it = A.rowsMap.begin(); + vt = jt->second.vecMap.begin(); + while(it != A.rowsMap.end() && vt != jt->second.vecMap.end()) { + if(it->first > vt->first) { // A has no row at index vt->first + SparseVector SV(A.cols()); + SV.vecMap[j] = vt->second; + A.rowsMap[vt->first] = SV; + ++vt; + } + else if(vt->first > it->first) { // resids are missing at this row + ++it; + } + else { // match - equal indexes + A.rowsMap[vt->first].vecMap[j] = vt->second; + ++it; + ++vt; + } + } + + } // end SrifMU + + //--------------------------------------------------------------------------- + template + void SrifMU(Matrix& R, Vector& Z, SparseMatrix& P, + Vector& D, const unsigned int M) throw(Exception) + { + try { + SparseMatrix A(P||D); + SrifMU(R,Z,A,M); + // copy residuals out of A into D + D = Vector(A.colCopy(A.cols()-1)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + +} // namespace + +#endif // define SPARSE_MATRIX_INCLUDE diff --git a/ext/lib/Geomatics/SparseVector.cpp b/ext/lib/Geomatics/SparseVector.cpp new file mode 100644 index 000000000..0d0b1e269 --- /dev/null +++ b/ext/lib/Geomatics/SparseVector.cpp @@ -0,0 +1,9 @@ +/// @file SparseVector.cpp Class for a sparse vector. + +#include "SparseVector.hpp" +namespace gpstk +{ + /// tolerance in considering element to be zero is std::abs(elem) < tolerance + /// see zeroize(), where this is the default input value + template const double SparseVector::zeroTolerance=1.0e-14; +} diff --git a/ext/lib/Geomatics/SparseVector.hpp b/ext/lib/Geomatics/SparseVector.hpp new file mode 100644 index 000000000..7e07fa6cc --- /dev/null +++ b/ext/lib/Geomatics/SparseVector.hpp @@ -0,0 +1,946 @@ +/// @file SparseVector.hpp Class for a sparse vector. + +#ifndef SPARSE_VECTOR_INCLUDE +#define SPARSE_VECTOR_INCLUDE + +#include "MathBase.hpp" // defines ABS SQRT +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +/// @file SparseVector.hpp Class for template sparse vectors; use with SparseMatrix. + +// TODO +// outer product? + +#include + +#include +#include +#include +#include // for find,lower_bound +#include + +#include "Vector.hpp" +#include "Matrix.hpp" + +namespace gpstk +{ + /// forward declarations + template class SparseVector; + template class SparseMatrix; + + //--------------------------------------------------------------------------- + /// Proxy class for elements of the SparseVector (SV). This allows disparate + /// treatment of rvalues and lvalues. + template class SVecProxy + { + public: + /// constructor + SVecProxy(SparseVector& SV, unsigned int index); + + /// operator = for non-const (lvalue) + SVecProxy& operator=(const SVecProxy& rhs) + { assign(rhs); return *this; } + /// operator = for const (rvalue) + SVecProxy& operator=(T rhs) + { assign(rhs); return *this; } + + /// cast or implicit conversion + operator T() const; + + /// operator+= for non-const (lvalue) + SVecProxy& operator+=(const SVecProxy& rhs) + { assign(value()+rhs); return *this; } + + /// operator+= for const (rvalue) + SVecProxy& operator+=(T rhs) + { assign(value()+rhs); return *this; } + + /// operator-= for non-const (lvalue) + SVecProxy& operator-=(const SVecProxy& rhs) + { assign(value()-rhs); return *this; } + + /// operator-= for const (rvalue) + SVecProxy& operator-=(T rhs) + { assign(value()-rhs); return *this; } + + /// operator*= for non-const (lvalue) + SVecProxy& operator*=(const SVecProxy& rhs) + { assign(value()*rhs); return *this; } + + /// operator*= for const (rvalue) + SVecProxy& operator*=(T rhs) + { assign(value()*rhs); return *this; } + + private: + /// reference to the vector to which this data belongs + SparseVector& mySV; + + /// index in mySV for this data + unsigned int index; + + /// get the value of the SparseVector at index + T value(void) const; + + /// assign the SparseVector element, used by operator=,+=,etc + void assign(T rhs); + + }; // end class SVecProxy + + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // must declare friends before the class + // output stream + template + std::ostream& operator<<(std::ostream& os, const SparseVector& SV); + // operators + template T norm(const SparseVector& SV); + template T cosVec(const SparseVector& S1, const SparseVector& S2); + template T cosVec(const SparseVector& SV, const Vector& V); + template T cosVec(const Vector& V, const SparseVector& SV); + template T dot(const SparseVector& SL, const SparseVector& SR); + template T dot_lim(const SparseVector& SL, const SparseVector& SR, + const unsigned int kb, const unsigned int ke); + template T dot(const SparseVector& SL, const Vector& SR); + template T dot(const Vector& SL, const SparseVector& SR); + template T min(const SparseVector& SV); + template T max(const SparseVector& SV); + template T minabs(const SparseVector& SV); + template T maxabs(const SparseVector& SV); + + // TD? outer product - put in Matrix + // addition and subtraction + template SparseVector operator-(const SparseVector& L, + const SparseVector& R); + template SparseVector operator-(const SparseVector& L, + const Vector& R); + template SparseVector operator-(const Vector& L, + const SparseVector& R); + template SparseVector operator+(const SparseVector& L, + const SparseVector& R); + template SparseVector operator+(const SparseVector& L, + const Vector& R); + template SparseVector operator+(const Vector& L, + const SparseVector& R); + // SparseMatrix + template SparseMatrix transpose(const SparseMatrix& M); + template SparseMatrix transform(const SparseMatrix& M, + const SparseMatrix& C) throw(Exception); + template SparseVector operator*(const SparseMatrix& L, + const SparseVector& V); + template SparseVector operator*(const SparseMatrix& L, + const Vector& V); + template SparseMatrix operator*(const SparseMatrix& L, + const SparseMatrix& R); + template SparseMatrix operator*(const SparseMatrix& L, + const Matrix& R); + template SparseMatrix operator*(const Matrix& L, + const SparseMatrix& R); + template SparseMatrix operator||(const SparseMatrix& L, + const Vector& V); + template SparseMatrix operator||(const SparseMatrix& L, + const SparseMatrix& R); + template SparseMatrix inverse(const SparseMatrix& A) + throw(Exception); + template SparseMatrix lowerCholesky(const SparseMatrix& A) + throw(Exception); + template SparseMatrix inverseLT(const SparseMatrix& LT, + T *ptrSmall=NULL, T *ptrBig=NULL) throw(Exception); + // special matrices + template SparseMatrix identSparse(const unsigned int dim) throw(); + + // diag of P * C * PT + template Vector transformDiag(const SparseMatrix& P, + const Matrix& C) throw(Exception); + // Householder + template SparseMatrix SparseHouseholder(const SparseMatrix& A) + throw(Exception); + template void SrifMU(Matrix& R, Vector& Z, SparseMatrix& A, + const unsigned int M=0) throw(Exception); + template void SrifMU(Matrix& R, Vector& Z, SparseMatrix& P, + Vector& D, const unsigned int M=0) throw(Exception); + + //--------------------------------------------------------------------------- + /// Class SparseVector. This class is designed to present an interface nearly + /// identical to class Vector, but more efficiently handle sparse vectors, in + /// which most of the elements are zero. The class stores only non-zero elements + /// in a map with key = index; it also stores a nominal length. The class uses + /// a proxy class, SVecProxy, to access elements; this allows rvalues and + /// lvalues to be treated separately. + template class SparseVector + { + public: + /// Proxy needs access to vecMap + friend class SVecProxy; + friend class SparseMatrix; + + /// lots of friends + // output stream operator + friend std::ostream& operator<< (std::ostream& os, const SparseVector& S); + // operators: norm, cos, etc (dot is member) + friend T norm(const SparseVector& SV); + friend T cosVec(const SparseVector& S1, const SparseVector& S2); + friend T cosVec(const SparseVector& SV, const Vector& V); + friend T cosVec(const Vector& V, const SparseVector& SV); + friend T dot(const SparseVector& SL, const SparseVector& SR); + friend T dot_lim(const SparseVector& SL, const SparseVector& SR, + const unsigned int kb, const unsigned int ke); + friend T dot(const SparseVector& SL, const Vector& SR); + friend T dot(const Vector& SL, const SparseVector& SR); + friend T min(const SparseVector& SV); + friend T max(const SparseVector& SV); + friend T minabs(const SparseVector& SV); + friend T maxabs(const SparseVector& SV); + // arithmetic + friend SparseVector operator-(const SparseVector& L, + const SparseVector& R); + friend SparseVector operator-(const SparseVector& L, + const Vector& R); + friend SparseVector operator-(const Vector& L, + const SparseVector& R); + friend SparseVector operator+(const SparseVector& L, + const SparseVector& R); + friend SparseVector operator+(const SparseVector& L, + const Vector& R); + friend SparseVector operator+(const Vector& L, + const SparseVector& R); + // SparseMatrix + friend SparseMatrix transpose(const SparseMatrix& M); + friend SparseMatrix transform(const SparseMatrix& M, + const SparseMatrix& C) throw(Exception); + friend SparseVector operator*(const SparseMatrix& L, + const SparseVector& V); + friend SparseVector operator*(const SparseMatrix& L, + const Vector& V); + friend SparseMatrix operator*(const SparseMatrix& L, + const SparseMatrix& V); + friend SparseMatrix operator*(const SparseMatrix& L, + const Matrix& R); + friend SparseMatrix operator*(const Matrix& L, + const SparseMatrix& R); + friend SparseMatrix operator||(const SparseMatrix& L, + const Vector& V); + friend SparseMatrix operator||(const SparseMatrix& L, + const SparseMatrix& R); + friend SparseMatrix inverse(const SparseMatrix& A) throw(Exception); + friend SparseMatrix lowerCholesky(const SparseMatrix& A) + throw(Exception); + friend SparseMatrix inverseLT(const SparseMatrix& LT, + T *ptrSmall, T *ptrBig) throw(Exception); + // special matrices + friend SparseMatrix identSparse(const unsigned int dim) throw(); + + // diag of P * C * PT + friend Vector transformDiag(const SparseMatrix& P, + const Matrix& C) throw(Exception); + // Householder + friend SparseMatrix SparseHouseholder(const SparseMatrix& A) + throw(Exception); + friend void SrifMU(Matrix& R, Vector& Z, SparseMatrix& A, + const unsigned int M) throw(Exception); + friend void SrifMU(Matrix& R, Vector& Z, SparseMatrix& P, + Vector& D, const unsigned int M) throw(Exception); + + /// tolerance in considering element to be zero is std::abs(elem) < tolerance + /// see zeroize(), where this is the default input value + static const double zeroTolerance; + + /// empty constructor + SparseVector(void) : len(0) { } + + /// constructor with length + SparseVector(const unsigned int N) : len(N) { } + + /// constructor from regular Vector + SparseVector(const Vector& V); + + /// subvector constructor + /// @param SV SparseVector to copy + /// @param ind starting index for the copy + /// @param len length of new SparseVector + SparseVector(const SparseVector& SV, + const unsigned int& ind, const unsigned int& len); + + // TD watch for unintended consequences - cast to Vector to use some Vector::fun + /// cast to Vector or implicit conversion to Matrix + operator Vector() const; + + /// size - of the real Vector, not the data array + inline unsigned int size(void) const { return len; } + + /// datasize - number of non-zero data + inline unsigned int datasize(void) const { return vecMap.size(); } + + /// is this SV empty? NB may have to call zeroize() to get a yes. + inline bool isEmpty(void) const + { return (vecMap.begin() == vecMap.end()); } + + /// density - ratio of number of non-zero element to size() + inline double density(void) const + { return (double(vecMap.size())/double(len)); } + + /// truncate - removes elements, if necessary, at and beyond column index j + /// same as resize(n) but does not change the nominal length len. + inline void truncate(const unsigned int n) + { + if(n == 0) + vecMap.clear(); + else if(n < len) { + typename std::map::iterator it; + // lower_bound returns it for first key >= newlen + it = vecMap.lower_bound(n); + vecMap.erase(it,vecMap.end()); + } + } + + /// resize - remove elements (truncate) and change nominal length len + inline void resize(const unsigned int newlen) + { + truncate(newlen); + len = newlen; + } + + /// clear - set all data to 0 (i.e. remove all data); leave length alone + inline void clear(void) { vecMap.clear(); } + + /// zeroize - remove elements that are less than or equal to tolerance + /// in abs value. Called with a non-zero tolerance only by the user. + /// NB this class and SparseMatrix call this when constructing a new object, + /// e.g. after matrix multiply, but ONLY with the tolerance T(0). + void zeroize(const T tol=static_cast(zeroTolerance)); + + /// true if the element is non-zero + inline bool isFilled(const unsigned int i) const + { return (vecMap.find(i) != vecMap.end()); } + + // operators ---------------------------------------------------- + /// operator[] for const, but SVecProxy does all the work + const SVecProxy operator[](unsigned int in) const + { + #ifdef RANGECHECK + if(in >= len) GPSTK_THROW(Exception("index out of range")); + #endif + return SVecProxy(const_cast(*this), in); + } + + /// operator[] for non-const, but SVecProxy does all the work + SVecProxy operator[](unsigned int in) + { + #ifdef RANGECHECK + if(in >= len) GPSTK_THROW(Exception("index out of range")); + #endif + return SVecProxy(*this, in); + } + + // output ------------------------------------------------------- + /// Dump only non-zero values, with indexes (i,value) + std::string dump(const int p=3,bool dosci=false) const + { + std::ostringstream oss; + size_t i; + oss << "len=" << len << ", N=" << vecMap.size(); + oss << (dosci ? std::scientific : std::fixed) << std::setprecision(p); + typename std::map::const_iterator it = vecMap.begin(); + for( ; it != vecMap.end(); ++it) + oss << " " << it->first << "," << it->second; // << ")"; + return oss.str(); + } + + // operations --------------------------------------------------- + /// Sum of elements + inline T sum(const SparseVector& SV) const + { + T tot(0); + typename std::map::iterator it = vecMap.begin(); + for( ; it != vecMap.end(); ++it) + tot += it->second; + return tot; + } + + // arithmetic and other operators + SparseVector& operator-=(const SparseVector& SV); + SparseVector& operator-=(const Vector& SV); + SparseVector& operator+=(const SparseVector& SV); + SparseVector& operator+=(const Vector& SV); + SparseVector& operator*=(const T& value); + SparseVector& operator/=(const T& value); + // special case for use with matrix inverse + void addScaledSparseVector(const T& a, const SparseVector& SV); + + // unary minus + SparseVector operator-() const + { + //std::cout << " SV unary minus with len " << len << std::endl; + SparseVector toRet(*this); + typename std::map::iterator it; + for(it = toRet.vecMap.begin(); it != toRet.vecMap.end(); ++it) { + toRet.vecMap[it->first] = -toRet.vecMap[it->first]; + } + return toRet; + } + + private: + /// length of the "real" vector (not the number of data stored = vecMap.size()) + unsigned int len; + + /// map of index,value pairs; vecMap[index in real vector] = data element + std::map vecMap; + + /// return a vector containing all the indexes, in order, of non-zero elements. + inline std::vector getIndexes(void) const + { + std::vector vecind; + typename std::map::const_iterator it; + for(it = vecMap.begin(); it != vecMap.end(); ++it) + vecind.push_back(it->first); + return vecind; + } + + }; // end class SparseVector + + + //--------------------------------------------------------------------------- + // implementation of SVecProxy + //--------------------------------------------------------------------------- + // Default constructor + template SVecProxy::SVecProxy(SparseVector& sv, unsigned int i) + : mySV(sv), index(i) { } + + //--------------------------------------------------------------------------- + // get the value of the SparseVector at index + template T SVecProxy::value(void) const + { + typename std::map::iterator it = mySV.vecMap.find(index); + if(it != mySV.vecMap.end()) + return it->second; + return T(0); + } + + //--------------------------------------------------------------------------- + // assignment, used by operator=, operator+=, etc + template void SVecProxy::assign(T rhs) + { + // zero or default - remove from map + if(T(rhs) == T(0)) { + typename std::map::iterator it = mySV.vecMap.find(index); + if(it != mySV.vecMap.end()) + mySV.vecMap.erase(it); + } + + // add/replace it in the map + else { + (static_cast< std::map< unsigned int, T>& >(mySV.vecMap))[index] = rhs; + } + } + + //--------------------------------------------------------------------------- + // cast + template SVecProxy::operator T() const + { + typename std::map::iterator it = mySV.vecMap.find(index); + if(it != mySV.vecMap.end()) + return (*it).second; + else + return T(0); + } + + + //--------------------------------------------------------------------------- + // implementation of SparseVector + //--------------------------------------------------------------------------- + // constructor from regular Vector + template SparseVector::SparseVector(const Vector& V) + { + len = V.size(); + for(unsigned int i=0; i SparseVector::SparseVector(const SparseVector& SV, + const unsigned int& ind, const unsigned int& n) + { + if(ind+n > SV.len) + GPSTK_THROW(Exception("Invalid input subvector c'tor - out of range")); + if(n == 0) return; + + len = n; + typename std::map::const_iterator it; + for(it = SV.vecMap.begin(); it != SV.vecMap.end(); ++it) { + if(it->first < ind) continue; // skip ones before ind + if(it->first > ind+n) break; + vecMap[it->first-ind] = it->second; + } + } + + // cast to Vector + template SparseVector::operator Vector() const + { + Vector toRet(len,T(0)); + typename std::map< unsigned int, T >::const_iterator it; + for(it = vecMap.begin(); it != vecMap.end(); ++it) { + toRet(it->first) = it->second; + } + + return toRet; + } + + // zeroize - remove elements that are less than or equal to tolerance in abs value + // Called with a non-zero tolerance only by the user. + // NB this class and SparseMatrix call this when constructing a new object, + // e.g. after matrix multiply, but ONLY with the tolerance T(0). + template + void SparseVector::zeroize(const T tol) + { + std::vector toDelete; + typename std::map::iterator it; + + for(it = vecMap.begin(); it != vecMap.end(); ++it) { + if(ABS(it->second) <= tol) + toDelete.push_back(it->first); + } + + for(unsigned int i=0; i + std::ostream& operator<<(std::ostream& os, const SparseVector& SV) + { + std::ofstream savefmt; + savefmt.copyfmt(os); + + unsigned int i; // the "real" vector index + typename std::map::const_iterator it = SV.vecMap.begin(); + for(i=0; i 0) os << std::setw(1) << ' '; + os.copyfmt(savefmt); + if(it != SV.vecMap.end() && i == it->first) { + os << it->second; + ++it; + } + else + os << "0"; + } + + return os; + } + + //--------------------------------------------------------------------------- + // Norm = sqrt(sum(squares)) + template T norm(const SparseVector& SV) + { + typename std::map::const_iterator it = SV.vecMap.begin(); + if(it == SV.vecMap.end()) + return T(0); + + T tn(ABS(it->second)); // cmath/cstdlib makes this valid for std types + for( ; it != SV.vecMap.end(); ++it) { + if(tn > ABS(it->second)) + tn *= SQRT(T(1) + (it->second/tn)*(it->second/tn)); + else if(tn < ABS(it->second)) + tn = ABS(it->second) * SQRT(T(1)+(tn/it->second)*(tn/it->second)); + else + tn *= SQRT(T(2)); + } + return tn; + } + + //--------------------------------------------------------------------------- + // cosine of angle between two vectors + template T cosVec(const SparseVector& S1, const SparseVector& S2) + { + T cv; + // try in case RANGECHECK is set + try { cv = S1.dot(S2); } + catch(Exception& e) { GPSTK_RETHROW(e); } + + T norm1(norm(S1)), norm2(norm(S2)); + if(norm1 == T(0) || norm2 == T(0)) + GPSTK_THROW(Exception("zero norm")); + + return ((cv/norm1)/norm2); + } + + template T cosVec(const SparseVector& SV, const Vector& V) + { + T cv; + // try in case RANGECHECK is set + try { cv = SV.dot(V); } + catch(Exception& e) { GPSTK_RETHROW(e); } + + T norm1(norm(SV)), norm2(norm(V)); + if(norm1 == T(0) || norm2 == T(0)) + GPSTK_THROW(Exception("zero norm")); + + return ((cv/norm1)/norm2); + } + + template T cosVec(const Vector& V, const SparseVector& SV) + { return cosVec(SV,V); } + + //--------------------------------------------------------------------------- + // dot products + /// dot (SparseVector, SparseVector) + template T dot(const SparseVector& SL, const SparseVector& SR) + { + if(SL.size() != SR.size()) GPSTK_THROW(Exception("length mismatch")); + T value(0); + typename std::map::const_iterator it = SL.vecMap.begin(); + typename std::map::const_iterator jt = SR.vecMap.begin(); + while(it != SL.vecMap.end() && jt != SR.vecMap.end()) { + if(it->first > jt->first) + ++jt; + else if(jt->first > it->first) + ++it; + else { + value += it->second * jt->second; + ++it; + ++jt; + } + } + return value; + } + + /// dot (SparseVector, SparseVector) but only use indexes k=kb, k T dot_lim(const SparseVector& SL, const SparseVector& SR, + const unsigned int kb, const unsigned int ke) + { + if(SL.size() != SR.size()) GPSTK_THROW(Exception("length mismatch")); + T value(0); + typename std::map::const_iterator it = SL.vecMap.begin(); + typename std::map::const_iterator jt = SR.vecMap.begin(); + while(it != SL.vecMap.end() && jt != SR.vecMap.end()) { + if(it->first >= ke || jt->first >= ke) break; + if(it->first > jt->first || jt->first < kb) + ++jt; + else if(jt->first > it->first || it->first < kb) + ++it; + else { // equal indexes: it->first == jt->first + if(it->first >= kb) value += it->second * jt->second; + ++it; + ++jt; + } + } + return value; + } + + /// dot (SparseVector, Vector) + template T dot(const SparseVector& SL, const Vector& R) + { + if(SL.size() != R.size()) GPSTK_THROW(Exception("length mismatch")); + T value(0); + typename std::map::const_iterator it; + for(it = SL.vecMap.begin(); it != SL.vecMap.end(); ++it) { + value += it->second * R[it->first]; + } + return value; + } + + /// dot (Vector, SparseVector) + template T dot(const Vector& L, const SparseVector& SR) + { + return dot(SR,L); + } + + template T min(const SparseVector& SV) + { + typename std::map::const_iterator it = SV.vecMap.begin(); + if(it == SV.vecMap.end()) return T(0); + T value(it->second); + for(++it; it != SV.vecMap.end(); ++it) + if(it->second < value) value = it->second; + return value; + } + + template T max(const SparseVector& SV) + { + typename std::map::const_iterator it = SV.vecMap.begin(); + if(it == SV.vecMap.end()) return T(0); + T value(it->second); + for(++it; it != SV.vecMap.end(); ++it) + if(it->second > value) value = it->second; + return value; + } + + template T minabs(const SparseVector& SV) + { + typename std::map::const_iterator it = SV.vecMap.begin(); + if(it == SV.vecMap.end()) return T(0); + T value(ABS(it->second)); + for(++it; it != SV.vecMap.end(); ++it) + if(ABS(it->second) < value) value = ABS(it->second); + return value; + } + + template T maxabs(const SparseVector& SV) + { + typename std::map::const_iterator it = SV.vecMap.begin(); + if(it == SV.vecMap.end()) return T(0); + T value(ABS(it->second)); + for(++it; it != SV.vecMap.end(); ++it) + if(ABS(it->second) > value) value = ABS(it->second); + return value; + } + + //--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // addition and subtraction + // member function operator-=(SparseVector) + template + SparseVector& SparseVector::operator-=(const SparseVector& R) + { + if(len != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op-=(SV)")); + + typename std::map::const_iterator Rit; + for(Rit = R.vecMap.begin(); Rit != R.vecMap.end(); ++Rit) { + if(vecMap.find(Rit->first) == vecMap.end()) + vecMap[Rit->first] = -Rit->second; + else + vecMap[Rit->first] -= Rit->second; + } + zeroize(T(0)); + + return *this; + } + + // member function operator-=(Vector) + template + SparseVector& SparseVector::operator-=(const Vector& R) + { + if(len != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op-=(V)")); + + for(unsigned int i=0; i + SparseVector& SparseVector::operator+=(const SparseVector& R) + { + if(len != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op+=(SV)")); + + typename std::map::const_iterator Rit; + for(Rit = R.vecMap.begin(); Rit != R.vecMap.end(); ++Rit) { + if(vecMap.find(Rit->first) == vecMap.end()) + vecMap[Rit->first] = Rit->second; + else + vecMap[Rit->first] += Rit->second; + } + zeroize(T(0)); + + return *this; + } + + // member function operator+=(Vector) + template + SparseVector& SparseVector::operator+=(const Vector& R) + { + if(len != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op+=(V)")); + //std::cout << " op+=(V)" << std::endl; + + for(unsigned int i=0; i + void SparseVector::addScaledSparseVector(const T& a, const SparseVector& R) + { + if(a == T(0)) return; + if(len != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions addScaledSparseVector()")); + + for(unsigned int i=0; i + SparseVector& SparseVector::operator*=(const T& value) + { + if(value == T(0)) { + resize(0); + } + else { + typename std::map::iterator it; + for(it=vecMap.begin(); it != vecMap.end(); ++it) { + it->second *= value; + } + } + + return *this; + } + + // member function operator/=(scalar) + template + SparseVector& SparseVector::operator/=(const T& value) + { + if(value == T(0)) GPSTK_THROW(Exception("Divide by zero")); + + typename std::map::iterator it; + for(it=vecMap.begin(); it != vecMap.end(); ++it) { + it->second /= value; + } + + return *this; + } + + // SparseVector = SparseVector - SparseVector + template SparseVector operator-(const SparseVector& L, + const SparseVector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op-(SV,SV)")); + + //std::cout << "Call copy ctor from op-(SV,SV)" << std::endl; + SparseVector retSV(L); + retSV -= R; + + return retSV; + } + + // SparseVector = SparseVector - Vector + template SparseVector operator-(const SparseVector& L, + const Vector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op-(SV,V)")); + //std::cout << "Call copy ctor from op-(SV,V)" << std::endl; + + SparseVector retSV(L); + retSV -= R; + + return retSV; + } + + // SparseVector = Vector - SparseVector + template SparseVector operator-(const Vector& L, + const SparseVector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op-(V,SV)")); + //std::cout << "Call copy ctor from op-(V,SV)" << std::endl; + + SparseVector retSV(R); + retSV = -retSV; + retSV += L; + + return retSV; + } + + // SparseVector = SparseVector + SparseVector + template SparseVector operator+(const SparseVector& L, + const SparseVector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op+(SV,SV)")); + //std::cout << "Call copy ctor from op+(SV,SV)" << std::endl; + + SparseVector retSV(R); + retSV += L; + + return retSV; + } + + // SparseVector = SparseVector + Vector + template SparseVector operator+(const SparseVector& L, + const Vector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op+(SV,V)")); + //std::cout << "Call copy ctor from op+(SV,V)" << std::endl; + + SparseVector retSV(L); + retSV += R; + + return retSV; + } + + // SparseVector = Vector + SparseVector + template SparseVector operator+(const Vector& L, + const SparseVector& R) + { + if(L.size() != R.size()) + GPSTK_THROW(Exception("Incompatible dimensions op+(V,SV)")); + //std::cout << "Call copy ctor from op+(V,SV)" << std::endl; + + SparseVector retSV(R); + retSV += L; + + return retSV; + } + +} // namespace + +#endif // define SPARSE_VECTOR_INCLUDE diff --git a/ext/lib/Geomatics/SpecialFuncs.hpp b/ext/lib/Geomatics/SpecialFuncs.hpp new file mode 100644 index 000000000..1d323234e --- /dev/null +++ b/ext/lib/Geomatics/SpecialFuncs.hpp @@ -0,0 +1,833 @@ +/// @file SpecialFuncs.hpp +/// Implementation of special functions, including log Gamma, factorial, binomial +/// coefficients, beta, incomplete beta, and error functions, as well as +/// probability density functions (PDFs) for various distributions, with their +/// cumulative distribution (CDF) and percent point (inverse CDF) functions; +/// these include the Chi square, Student t and F distributions. +/// The percent point function PPf() is the inverse of the CDF() : +/// PPf(alpha,N1,N2) == F where alpha=CDF(F,N1,N2). +/// References: the NIST Engineering Statistics Handbook, 2006 +/// http://www.itl.nist.gov/div898/handbook/ and Abramowitz and Stegun. + +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================= + +#ifndef SPECIAL_FUNCTIONS_INCLUDE +#define SPECIAL_FUNCTIONS_INCLUDE + +#include +#include +#include "Exception.hpp" +//#include "logstream.hpp" // TEMP +//#include // TEMP +//#include // TEMP + +namespace gpstk +{ + // ----------------- special functions ------------------------------- + + /// Natural log of the gamma function for positive argument. + /// Gamma(x) = integral(0 to inf) { t^(x-1) exp(-t) dt } + /// @param x argument, x must be > 0 + /// @return double ln(gamma(x)), the natural log of the gamma function of x. + /// @throw if the input argument is <= 0 + double lnGamma(const double& x) throw(Exception) + { + try { + static const double con[8] = { + 76.18009172947146, -86.50532032941677, 24.01409824083091, + -1.231739572450155, 1.208650973866179e-3, -5.395239384953e-6, + 1.000000000190015, 2.5066282746310005 }; + + if(x <= 0) GPSTK_THROW(Exception("Non-positive argument")); + + double y(x); + double t(x+5.5); + t -= (x+0.5) * ::log(t); + double s(con[6]); + for(int i=0; i<=5; i++) s += con[i] / ++y; + + return (-t + ::log(con[7]*s/x)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Gamma(x) the gamma function for positive argument. + /// Gamma(x) = integral(0 to inf) { t^(x-1) exp(-t) dt } + /// @param x argument, x must be > 0 + /// @return double Gamma(x), the gamma function of x. + /// @throw if the input argument is <= 0 + double Gamma(const double& x) throw(Exception) + { + try { + return ::exp(lnGamma(double(x))); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Factorial of an integer, returned as a double. + /// @param n argument, n must be >= 0 + /// @return n! or factorial(n), as a double + /// @throw if the input argument is < 0 + double factorial(const int& n) throw(Exception) + { + try { + if(n < 0) GPSTK_THROW(Exception("Negative argument")); + + if(n > 32) return ::exp(lnGamma(double(n+1))); + + static double store[33] = { 1.0, 1.0, 2.0, 6.0, 24.0, 120.0 }; + static int nstore=5; + + while(nstore < n) { + int i = nstore++; + store[nstore] = store[i] * nstore; + } + + return store[n]; + + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// ln of Factorial of an integer, returned as a double. + /// @param n argument, n must be >= 0 + /// @return ln(n!) or natural log of factorial(n), as a double + /// @throw if the input argument is < 0 + double lnFactorial(const int& n) throw(Exception) + { + try { + if(n < 0) GPSTK_THROW(Exception("Negative argument")); + if(n <= 1) return 0.0; + return lnGamma(double(n+1)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Binomial coefficient (n k) = n!/[k!(n-k)!], 0 <= k <= n. + /// (n k) is the number of combinations of n things taken k at a time. + /// NB. (n+1 k) = [ (n+1)/(n-k+1) ] (n k) = (n k) + (n k-1) + /// NB. (n k+1) = [ (n-k)/(k+1) ] (n k) + /// @param n int n must be >= 0 + /// @param k int k must be >= 0 and <= n + /// @return (n k), the binomial coefficient + /// @throw if the input argument do not satisfy 0 <= k <= n + double binomialCoeff(const int& n, const int& k) throw(Exception) + { + try { + if(n < 0 || k > n) GPSTK_THROW(Exception("Invalid arguments")); + + if(n <= 32) return (factorial(n) / (factorial(k)*factorial(n-k))); + + return floor(0.5 + ::exp(lnFactorial(n)-lnFactorial(k)-lnFactorial(n-k))); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Beta function. Beta(x,y)=Beta(y,x)=integral(0 to 1) {t^(x-1)*(1-t)^(y-1) dt}. + /// Also, Beta(x,y) = gamma(x)*gamma(y)/gamma(x+y). + /// @param x first argument + /// @param y second argument + /// @return beta(x,y) + /// @throw if either input argument is <= 0 + double beta(const double& x, const double& y) throw(Exception) + { + try { + return ::exp(lnGamma(x) + lnGamma(y) - lnGamma(x+y)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Incomplete gamma function P(a,x), evaluated using series representation. + /// P(a,x) = (1/gamma(a)) integral (0 to x) { exp(-t) t^(a-1) dt } + /// @param a first argument, a > 0 + /// @param x second argument, x >= 0 + /// @return P(a,x) + /// @throw if input arguments have a <= 0 or x < 0 + double seriesIncompGamma(const double& a, const double& x) throw(Exception) + { + try { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + if(a <= 0) GPSTK_THROW(Exception("Non-positive second argument")); + + static const int imax(400); + static const double eps(10*std::numeric_limits().epsilon()); + + double lngamma(lnGamma(a)); + + double atmp(a),sum(1.0/a); + double del(sum); + for(int i=1; i<=imax; i++) { + ++atmp; + del *= x/atmp; + sum += del; + if(::fabs(del) < ::fabs(sum)*eps) + return (sum * ::exp(-x + a * ::log(x) - lngamma)); + } + GPSTK_THROW(Exception("Overflow; first arg too big")); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + + return 0.0; + } + + /// Incomplete gamma function Q(a,x), evaluated using continued fractions. + /// Q(a,x) = (1/gamma(a)) integral (x to inf) { exp(-t) t^(a-1) dt } + /// @param a first argument, a > 0 + /// @param x second argument, x >= 0 + /// @return Q(a,x) + /// @throw if input arguments have a <= 0 or x < 0 + double contfracIncompGamma(const double& a, const double& x) throw(Exception) + { + try { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + if(a <= 0) GPSTK_THROW(Exception("Non-positive second argument")); + + static const int imax(100); + static const double eps(10*std::numeric_limits().epsilon()); + static const double fpmin(10*std::numeric_limits().min()); + + double lngamma(lnGamma(a)); + + double b(x+1.0-a),c(1.0/fpmin); + double d(1.0/b); + double h(d); + int i; + for(i=1; i<=imax; i++) { + double an(-i*(i-a)); + b += 2.0; + d = an*d+b; + if(::fabs(d) < fpmin) d=fpmin; + c = b+an/c; + if(::fabs(c) < fpmin) c=fpmin; + d = 1.0/d; + double del(d*c); + h *= del; + if(::fabs(del-1.0) < eps) break; + } + + if(i > imax) GPSTK_THROW(Exception("Overflow; first arg too big")); + + return (::exp(-x + a * ::log(x) - lngamma) * h); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Incomplete gamma function P(a,x), a,x > 0. + /// P(a,x) = (1/gamma(a)) integral (0 to x) { exp(-t) t^(a-1) dt }; a > 0, x >= 0 + /// @param a first argument, a > 0 + /// @param x second argument, x >= 0 + /// @return P(a,x) + /// @throw if input arguments have a <= 0 or x < 0 + double incompGamma(const double& a, const double& x) throw(Exception) + { + try { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + if(a <= 0) GPSTK_THROW(Exception("Non-positive second argument")); + + if(x < a+1.0) + return seriesIncompGamma(a,x); + else + return (1.0 - contfracIncompGamma(a,x)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Complement of incomplete gamma function Q(a,x), a > 0, x >= 0. + /// Q(a,x) = (1/gamma(a)) integral (x to inf) { exp(-t) t^(a-1) dt } + /// @param a first argument, a > 0 + /// @param x second argument, x >= 0 + /// @return Q(a,x) + /// @throw if input arguments have a <= 0 or x < 0 + double compIncompGamma(const double& a, const double& x) throw(Exception) + { + try { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + if(a <= 0) GPSTK_THROW(Exception("Non-positive second argument")); + + if(x < a+1.0) + return (1.0 - seriesIncompGamma(a,x)); + else + return contfracIncompGamma(a,x); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Error function erf(x). erf(x) = 2/sqrt(pi) * integral (0 to x) { exp(-t^2) dt } + /// @param x input argument + /// @return erf(x) + double errorFunc(const double& x) throw(Exception) + { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + try { + return (x < 0.0 ? -incompGamma(0.5,x*x) : incompGamma(0.5,x*x)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Complementary error function erfc(x). erfc(x) = 1-erf(x) + /// @param x input argument + /// @return erfc(x) + double compErrorFunc(const double& x) throw(Exception) + { + if(x < 0) GPSTK_THROW(Exception("Negative first argument")); + try { + return (x < 0.0 ? 1.0+incompGamma(0.5,x*x) : compIncompGamma(0.5,x*x)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + // Compute continued fractions portion of incomplete beta function I_x(a,b) + /// Routine used internally for Incomplete beta function I_x(a,b) + double cfIBeta(const double& x, const double& a, const double& b) throw(Exception) + { + static const int imax(100); + static const double eps(10*std::numeric_limits().epsilon()); + static const double fpmin(10*std::numeric_limits().min()); + const double qab(a+b); + const double qap(a+1.0); + const double qam(a-1.0); + double c(1),d(1-qab*x/qap),aa,del; + if(::fabs(d) < fpmin) d=fpmin; + d = 1.0/d; + double h(d); + int i,i2; + for(i=1; i<=imax; i++) { + i2 = 2*i; + aa = i*(b-i)*x/((qam+i2)*(a+i2)); + d = 1.0 + aa*d; + if(::fabs(d) < fpmin) d=fpmin; + c = 1.0 + aa/c; + if(::fabs(c) < fpmin) c=fpmin; + d = 1.0/d; + h *= d*c; + aa = -(a+i)*(qab+i)*x/((a+i2)*(qap+i2)); + d = 1.0 + aa*d; + if(::fabs(d) < fpmin) d=fpmin; + c = 1.0 + aa/c; + if(::fabs(c) < fpmin) c=fpmin; + d = 1.0/d; + del = d*c; + h *= del; + if(::fabs(del-1.0) < eps) break; + } + if(i > imax) + GPSTK_THROW(Exception("Overflow; a or b too big")); + + return h; + } + + /// Incomplete beta function I_x(a,b), 0<=x<=1, a,b>0 + /// I sub x (a,b) = (1/beta(a,b)) integral (0 to x) { t^(a-1)*(1-t)^(b-1)dt } + /// @param x input value, 0 <= x <= 1 + /// @param a input value, a > 0 + /// @param b input value, b > 0 + /// @return Incomplete beta function I_x(a,b) + double incompleteBeta(const double& x, const double& a, const double& b) + throw(Exception) + { + if(x < 0 || x > 1) GPSTK_THROW(Exception("Invalid x argument")); + if(a <= 0 || b <= 0) GPSTK_THROW(Exception("Non-positive argument")); + + if(x == 0) return 0.0; + if(x == 1) return 1.0; + + try { + double factor = ::exp(lnGamma(a+b) - lnGamma(a) - lnGamma(b) + + a * ::log(x) + b * ::log(1.0-x)); + if(x < (a+1.0)/(a+b+2.0)) + return factor*cfIBeta(x,a,b)/a; + else + return 1.0-factor*cfIBeta(1.0-x,b,a)/b; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + // ----------------- probability distributions ----------------------- + + /// Normal distribution of sample mean mu and sample std deviation sig + /// (location and scale parameters, resp.). + /// \code + /// NormalPDF(x,mu,sig) = exp(-(x-mu)*(x-mu)/(2*sig*sig)); + /// NormalCDF(x,mu,sig) = 0.5*(1+erf((x-mu)/(::sqrt(2)*sig)); + /// \endcode + /// For both theoretical and practical reasons, the normal distribution is + /// probably the most important distribution in statistics. + /// Many classical statistical tests are based on the assumption that the data + /// follow a normal distribution. (This assumption should be tested before + /// applying these tests.) In modeling applications, such as linear and non-linear + /// regression, the error term is often assumed to follow a normal distribution + /// with fixed location (mu) and scale (sig). + /// The normal distribution is widely used. Part of its appeal is that it is well + /// behaved and mathematically tractable. However, the central limit theorem + /// provides a theoretical basis for why it has wide applicability. + /// The central limit theorem states that as the sample size n becomes large, + /// the following occur: + /// The sampling distribution of the mean becomes approximately normal + /// regardless of the distribution of the original variable. + /// The sampling distribution of the mean is centered at the population mean, + /// mu, of the original variable. In addition, the standard deviation of the + /// sampling distribution of the mean approaches sig/sqrt(n). + /// Probability density function (PDF) of the Normal distribution. + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.1 + /// @param x input statistic + /// @param mu mean of the sample (location parameter of the distribution) + /// @param sig std dev of the sample (scale parameter of the distribution) + /// @return Normal distribution probability density + double NormalPDF(const double& x, const double& mu, const double& sig) + throw(Exception) + { + try { + return (::exp(-(x-mu)*(x-mu)/(2.0*sig*sig))); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Cumulative distribution function (CDF) of the Normal-distribution. + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.1 + /// @param x input statistic + /// @param mu mean of the sample (location parameter of the distribution) + /// @param sig std dev of the sample (scale parameter of the distribution) + /// @return Normal distribution probability + double NormalCDF(const double& x, const double& mu, const double& sig) + throw(Exception) + { + if(sig <= 0.0) GPSTK_THROW(Exception("Non-positive sigma")); + + try { + static const double sqrt2(::sqrt(2.0)); + double arg(x-mu); + double erf = errorFunc(::fabs(arg)/(sqrt2*sig)); + return (0.5 * (1.0 + (arg < 0.0 ? -erf : erf))); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Normal-distribution percent point function, or inverse of the Normal CDF. + /// This function(prob,mu,sig) == X where prob = NormalCDF(X,mu,sig). + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.1 + /// @param prob probability or significance level of the test, >=0 and < 1 + /// @param mu mean of the sample (location parameter of the distribution) + /// @param sig std dev of the sample (scale parameter of the distribution) + /// @return X the statistic at this probability + double invNormalCDF(double prob, const double& mu, const double& sig) + throw(Exception) + { + try { + if(prob < 0 || prob >= 1) + GPSTK_THROW(Exception("Invalid probability argument")); + if(sig <= 0.0) GPSTK_THROW(Exception("Non-positive sigma")); + + static const double eps(1000000*std::numeric_limits().epsilon()); + + if(prob < eps) + return 0.0; + if(1.0-prob < eps) + GPSTK_THROW(Exception("Invalid probability -- too close to 1.0")); + + // find X such that prob == NormalCDF(X,mu,sig); use bracket method + // we know 0.5 = NormalCDF(muwhen prob = 0.5, X = mu + // also invNormalCDF(1-prob,mu,sig) = 2*mu - invNormalCDF(prob,mu,sig) + // so make alpha >= 0.5 + bool swap(false); + double alpha(prob); + if(prob < 0.5) { swap=true; alpha=1.0-prob; } + + // we know a0 = NormalCDF(X0,mu,sig) where a0=0.5,X0=mu and alpha >= 0.5 + double X,X0(mu),X1,a; + // first find X1 such that a1 = NormalCDF(X1,mu,sig) and a1 > alpha + X1 = 2.0; + while((a = NormalCDF(X1,mu,sig)) <= alpha) { X1 *= 2.0; } + + // bracket + int niter(0); // iteration count + while(1) { + X = (X0+X1)/2.0; + a = NormalCDF(X,mu,sig); + //LOG(INFO) << "LOOP invNormalCDF X = " << niter << " " << std::fixed + //<< std::setprecision(15) << X0 << " < " << X << " < " << X1 + //<< " and a = " << a << " alpha = " << alpha << " a-alpha = " + //<< std::scientific << std::setprecision(2) << a-alpha << " eps " << eps + //<< " fabs(a-alpha)-eps " << ::fabs(alpha-a)-eps; + if(::fabs(alpha-a) < eps) break; + if(a > alpha) { X1 = X; } else { X0 = X; } + if(++niter > 100) GPSTK_THROW(Exception("Failed to converge")); + } + + return (swap ? 2.0*mu-X : X); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + + /// Probability density function (PDF) of the Chi-square distribution. + /// The chi-square distribution results when n independent variables with + /// standard normal distributions are squared and summed; x=RSS(variables). + /// + /// A chi-square test (Snedecor and Cochran, 1983) can be used to test if the + /// standard deviation of a population is equal to a specified value. This test + /// can be either a two-sided test or a one-sided test. The two-sided version + /// tests against the alternative that the true standard deviation is either + /// less than or greater than the specified value. The one-sided version only + /// tests in one direction. + /// The chi-square hypothesis test is defined as: + /// H0: sigma = sigma0 + /// Ha: sigma < sigma0 for a lower one-tailed test + /// sigma > sigma0 for an upper one-tailed test + /// sigma <>sigma0 for a two-tailed test + /// Test Statistic: T = T = (N-1)*(s/sigma0)**2 + /// where N is the sample size and s is the sample standard deviation. + /// The key element of this formula is the ratio s/sigma0 which compares the ratio + /// of the sample standard deviation to the target standard deviation. As this + /// ratio deviates from 1, the more likely is rejection of the null hypothesis. + /// Significance Level: alpha. + /// Critical Region: Reject the null hypothesis that the standard deviation + /// is a specified value, sigma0, if + /// T > chisquare(alpha,N-1) for an upper one-tailed alternative + /// T < chisquare(1-alpha,N-1) for a lower one-tailed alternative + /// T < chisquare(1-alpha,N-1) for a two-tailed test or + /// T < chisquare(1-alpha,N-1) + /// where chi-square(p,N-1) is the critical value or inverseCDF of the chi-square + /// distribution with N-1 degrees of freedom. + /// + /// @param x input statistic, equal to an RSS(); x >= 0 + /// @param n input value for number of degrees of freedom, n > 0 + /// @return probability Chi-square probability (xsq,n) + double ChisqPDF(const double& x, const int& n) throw(Exception) + { + if(x < 0) GPSTK_THROW(Exception("Negative statistic")); + if(n <= 0) + GPSTK_THROW(Exception("Non-positive degrees of freedom")); + + try { + double dn(double(n)/2.0); + return ( ::exp(-x/2.0) * ::pow(x,dn-1.0) / (::pow(2.0,dn) * Gamma(dn)) ); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Cumulative distribution function (CDF) of the Chi-square-distribution. + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.6 + /// @param x input statistic value, the RSS of variances, X >= 0 + /// @param n degrees of freedom of sample, n > 0 + /// @return probability that the sample variance is less than X. + double ChisqCDF(const double& x, const int& n) throw(Exception) + { + if(x < 0) GPSTK_THROW(Exception("Negative statistic")); + if(n <= 0) + GPSTK_THROW(Exception("Non-positive degrees of freedom")); + + try { + // NB this incompGamma(n/2,x/2) == NIST's incompGamma(n/2,x/2)/Gamma(n/2) + return incompGamma(double(n)/2.0,x/2.0); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Chi-square-distribution percent point function, or inverse of the Chisq CDF. + /// This function(alpha,N) == Y where alpha = ChisqCDF(Y,N). + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.6 + /// @param alpha probability or significance level of the test, >=0 and < 1 + /// @param n degrees of freedom of sample, n > 0 + /// @return X the statistic (an RSS of variances) at this probability + double invChisqCDF(double alpha, int n) throw(Exception) + { + try { + if(alpha < 0 || alpha >= 1) + GPSTK_THROW(Exception("Invalid probability argument")); + if(n <= 0) + GPSTK_THROW(Exception("Non-positive degree of freedom")); + + static const double eps(1000000*std::numeric_limits().epsilon()); + if(alpha < eps) + return 0.0; + if(1.0-alpha < eps) + GPSTK_THROW(Exception("Invalid probability -- too close to 1.0")); + + // find X such that alpha == ChisqCDF(X,n); use bracket method + // we know a0 = ChisqCDF(F0,n) where a0=F0=0 + double X,X0(0.0),X1,a; + // first find X1 such that a1 = ChisqCDF(X1,N) and a1 > alpha + X1 = 2.0; + while((a = ChisqCDF(X1,n)) <= alpha) { X1 *= 2.0; } + + // bracket + int niter(0); // iteration count + while(1) { + X = (X0+X1)/2.0; + a = ChisqCDF(X,n); + //LOG(INFO) << "LOOP invChisqCDF X = " << niter << " " << std::fixed + //<< std::setprecision(15) << X0 << " < " << X << " < " << X1 + //<< " and a = " << a << " alpha = " << alpha << " a-alpha = " + //<< std::scientific << std::setprecision(2) << a-alpha << " eps " << eps + //<< " fabs(a-alpha)-eps " << ::fabs(alpha-a)-eps; + if(::fabs(alpha-a) < eps) break; + if(a > alpha) { X1 = X; } else { X0 = X; } + if(++niter > 100) GPSTK_THROW(Exception("Failed to converge")); + } + + return X; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Probability density function (PDF) of the Student t distribution. + /// The null hypotheses that test the true mean, mu, against the standard or + /// assumed mean, mu0 are: + /// H0: mu = mu0 + /// H0: mu <= mu0 + /// H0: mu >= mu0 + /// The basic statistics for the test are the sample mean and the standard + /// deviation. The form of the test statistic depends on whether the poulation + /// standard deviation, sigma, is known or is estimated from the data at hand. + /// The more typical case is where the standard deviation must be estimated + /// from the data, and the test statistic is + /// t = (Ybar - mu0/(s/SQRT(N)) + /// where the sample mean is + /// Ybar = (1/N)*SUM[i=1 to N]Y(i) + /// and the sample standard deviation is + /// s = SQRT{(1/(N-1))*SUM[i=1 to N][Y(i) - Ybar)**2} + /// with N - 1 degrees of freedom. + /// For a test at significance level (probability) alpha, where alpha is chosen to + /// be small, typically .01, .05 or .10, the hypothesis associated with each case + /// enumerated above is rejected if: + /// |t| >= t(alpha/2,N-1) + /// t >= t(alpha,N-1) + /// t <= -t(alpha,N-1) + /// where t(alpha/2,N-1) is the upper alpha/2 critical value (inverse CDF) + /// from the t distribution with N-1 degrees of freedom. + /// @param X input statistic + /// @param n input value for number of degrees of freedom, n > 0 + /// @return probability density + double StudentsPDF(const double& X, const int& n) throw(Exception) + { + if(n <= 0) + GPSTK_THROW(Exception("Non-positive degrees of freedom")); + + try { + double dn(n); + return (::pow(1.0 + X*X/dn, -(dn+1)/2.0) / (::sqrt(dn) * beta(0.5,0.5*dn))); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Cumulative Distribution Function CDF() for Student-t-distribution CDF. + /// If X is a random variable following a normal distribution with mean zero and + /// variance unity, and chisq is a random variable following an independent + /// chi-square distribution with n degrees of freedom, then the distribution of + /// the ratio X/sqrt(chisq/n) is called Student's t-distribution with n degrees + /// of freedom. The probability that |X/sqrt(chisq/n)| will be less than a fixed + /// constant t is StudentCDF(t,n); + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.4 + /// Abramowitz and Stegun 26.7.1 + /// @param t input statistic value + /// @param n degrees of freedom of first sample, n > 0 + /// @return probability that the sample is less than X. + double StudentsCDF(const double& t, const int& n) + throw(Exception) + { + if(n <= 0) GPSTK_THROW(Exception("Non-positive degree of freedom")); + + try { + // NB StudentsCDF(-t,n) = 1.0-StudentsCDF(t,n); + double x = 0.5*incompleteBeta(double(n)/(t*t+double(n)),double(n)/2,0.5); + if(t >= 0.0) return (1.0 - x); + return (x); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Students-t-distribution percent point function, or inverse of the Student CDF. + /// This function(prob,n) == Y where prob = StudentsCDF(Y,n). + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.4 + /// @param prob probability or significance level of the test, >=0 and < 1 + /// @param n degrees of freedom of sample, n > 0 + /// @return t the statistic at this probability + double invStudentsCDF(double prob, int n) throw(Exception) + { + try { + if(prob < 0 || prob >= 1) + GPSTK_THROW(Exception("Invalid probability argument")); + if(n <= 0) + GPSTK_THROW(Exception("Non-positive degree of freedom")); + + static const double eps(1000000*std::numeric_limits().epsilon()); + if(prob < eps) + return 0.0; + if(1.0-prob < eps) + GPSTK_THROW(Exception("Invalid probability -- too close to 1.0")); + + // find X such that prob == StudentsCDF(X,n); use bracket method + + // NB StudentsCDF(-t,n) = 1.0-StudentsCDF(t,n); + bool swap(false); + double alpha(prob); + if(prob < 0.5) { swap=true; alpha=1.0-prob; } + + // we know a0 = StudentsCDF(t0,n) where a0=0.5,t0=0 and alpha >= 0.5 + double t,t0(0.0),t1,a; + // first find t1 such that a1 = StudentsCDF(t1,n) and a1 > alpha + t1 = 2.0; + while((a = StudentsCDF(t1,n)) <= alpha) { t1 *= 2.0; } + + // bracket + int niter(0); // iteration count + while(1) { + t = (t0+t1)/2.0; + a = StudentsCDF(t,n); + //LOG(INFO) << "LOOP invStudentsCDF t = " << niter << " " << std::fixed + //<< std::setprecision(15) << t0 << " < " << t << " < " << t1 + //<< " and a = " << a << " alpha = " << alpha << " a-alpha = " + //<< std::scientific << std::setprecision(2) << a-alpha << " eps " << eps + //<< " fabs(a-alpha)-eps " << ::fabs(alpha-a)-eps; + if(::fabs(alpha-a) < eps) break; + if(a > alpha) { t1 = t; } else { t0 = t; } + if(++niter > 100) GPSTK_THROW(Exception("Failed to converge")); + } + + return (swap ? -t : t); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// F-distribution cumulative distribution function FDistCDF(F,n1,n2) F>=0 n1,n2>0. + /// This function occurs in the statistical test of whether two observed samples + /// have the same variance. If F is the ratio of the observed dispersion (variance) + /// of the first sample to that of the second, where the first sample has n1 + /// degrees of freedom and the second has n2 degrees of freedom, then this function + /// returns the probability that F would be as large as it is if the first + /// sample's distribution has smaller variance than the second's. In other words, + /// FDistCDF(f,n1,n2) is the significance level at which the hypothesis + /// "sample 1 has smaller variance than sample 2" can be rejected. + /// A small numerical value implies a significant rejection, in turn implying + /// high confidence in the hypothesis "sample 1 has variance greater than or equal + /// to that of sample 2". + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.5 + /// @param F input statistic value, the ratio variance1/variance2, F >= 0 + /// @param n1 degrees of freedom of first sample, n1 > 0 + /// @param n2 degrees of freedom of second sample, n2 > 0 + /// @return probability that the sample is less than F. + double FDistCDF(const double& F, const int& n1, const int& n2) + throw(Exception) + { + if(F < 0) GPSTK_THROW(Exception("Negative statistic")); + if(n1 <= 0 || n2 <= 0) GPSTK_THROW(Exception("Non-positive degree of freedom")); + + try { + return (1.0 - incompleteBeta(double(n2)/(double(n2)+double(n1)*F), + double(n2)/2.0,double(n1)/2.0)); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// Probabiliy density function for F distribution + /// The F distribution is the ratio of two chi-square distributions with degrees + /// of freedom N1 and N2, respectively, where each chi-square has first been + /// divided by its degrees of freedom. + /// An F-test (Snedecor and Cochran, 1983) is used to test if the standard + /// deviations of two populations are equal. This test can be a two-tailed test or + /// a one-tailed test. + /// The F hypothesis test is defined as: + /// H0: s1 = s2 (sN is sigma or std deviation) + /// Ha: s1 < s2 for a lower one tailed test + /// s1 > s2 for an upper one tailed test + /// s1 != s2 for a two tailed test + /// Test Statistic: F = s1^2/s2^2 where s1^2 and s2^2 are the sample variances. + /// The more this ratio deviates from 1, the stronger the evidence for unequal + /// population variances. Significance Level is alpha, a probability (0<=alpha<=1). + /// The hypothesis that the two standard deviations are equal is rejected if + /// F > PP(alpha,N1-1,N2-1) for an upper one-tailed test + /// F < PP(1-alpha,N1-1,N2-1) for a lower one-tailed test + /// F < PP(1-alpha/2,N1-1,N2-1) for a two-tailed test + /// F > PP(alpha/2,N1-1,N2-1) + /// where PP(alpha,k-1,N-1) is the percent point function of the F distribution + /// [PPfunc is inverse of the CDF : PP(alpha,N1,N2) == F where alpha=CDF(F,N1,N2)] + /// with N1 and N2 degrees of freedom and a significance level of alpha. + /// + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.5 + /// @param x probability or significance level of the test, >=0 and < 1 + /// @param n1 degrees of freedom of first sample, n1 > 0 + /// @param n2 degrees of freedom of second sample, n2 > 0 + /// @return the statistic (a ratio variance1/variance2) at this prob + double FDistPDF(double x, int n1, int n2) throw(Exception) + { + try { + double dn1(n1),dn2(n2); + double F = Gamma((dn1+dn2)/2.0) / (Gamma(dn1/2.0)*Gamma(dn2/2.0)); + F *= ::pow(dn1/dn2,dn1/2.0) * ::pow(x,dn1/2.0 - 1.0); + F /= ::pow(1.0+x*dn1/dn2,(dn1+dn2)/2.0); + return F; + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + + /// F-distribution percent point function, or inverse of the F-dist CDF. + /// this function(prob,N1,N2) == F where prob = FDistCDF(F,N1,N2). + /// Ref http://www.itl.nist.gov/div898/handbook/ 1.3.6.6.5 + /// @param prob probability or significance level of the test, >=0 and < 1 + /// @param n1 degrees of freedom of first sample, n1 > 0 + /// @param n2 degrees of freedom of second sample, n2 > 0 + /// @return F the statistic (a ratio variance1/variance2) at this prob + double invFDistCDF(double prob, int n1, int n2) throw(Exception) + { + try { + if(prob < 0 || prob >= 1) + GPSTK_THROW(Exception("Invalid probability argument")); + if(n1 <= 0 || n2 <= 0) + GPSTK_THROW(Exception("Non-positive degree of freedom")); + + static const double eps(100000*std::numeric_limits().epsilon()); + if(prob < eps) + return 0.0; + if(1.0-prob < eps) + GPSTK_THROW(Exception("Invalid probability -- too close to 1.0")); + + // find F such that prob == FDistCDF(F,n1,n2); use bracket method + + // NB Abramowitz and Stegan 26.6.9: FDistCDF(F,n1,n2) = 1-FDistCDF(1/F,n2,n1) + bool swap(false); + int N1(n1),N2(n2); + double alpha(prob); + if(prob < 0.5) { swap=true; N1=n2, N2=n1; alpha=1.0-prob; } + + // we know a0 = FDistCDF(F0,N1,N2) where a0=F0=0 and alpha >= 0.5 + double F,F0(0.0),F1,a; + // first find F1 such that a1 = FDistCDF(F1,N1,N2) and a1 > alpha + F1 = 2.0; + while((a = FDistCDF(F1,N1,N2)) <= alpha) { F1 *= 2.0; } + + // bracket + int n(0); // iteration count + while(1) { + F = (F0+F1)/2.0; + a = FDistCDF(F,N1,N2); + //LOG(INFO) << "LOOP invFDistCDF F = " << n << " " << std::fixed + //<< std::setprecision(15) << F0 << " < " << F << " < " << F1 + //<< " and a = " << a << " alpha = " << alpha << " a-alpha = " + //<< std::scientific << std::setprecision(2) << a-alpha << " eps " << eps + //<< " fabs(a-alpha)-eps " << ::fabs(alpha-a)-eps; + if(::fabs(alpha-a) < eps) break; + if(a > alpha) { F1 = F; } else { F0 = F; } + n++; + if(n > 100) GPSTK_THROW(Exception("Failed to converge")); + } + + return (swap ? 1.0/F : F); + } + catch(Exception& e) { GPSTK_RETHROW(e); } + } + +} // end namespace + +#endif // SPECIAL_FUNCTIONS_INCLUDE diff --git a/ext/lib/Geomatics/SpecialFunctions.hpp b/ext/lib/Geomatics/SpecialFunctions.hpp deleted file mode 100644 index 7ca9fb7e0..000000000 --- a/ext/lib/Geomatics/SpecialFunctions.hpp +++ /dev/null @@ -1,489 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -/** - * @file SpecialFunctions.hpp - * Implementation of special functions, including log Gamma, factorial, binomial - * coefficients, beta, incomplete beta, Student distribution, F distribution, etc. - * Based on Numerical Recipes and Abramowitz and Stegun - */ - -#ifndef SPECIAL_FUNCTIONS_INCLUDE -#define SPECIAL_FUNCTIONS_INCLUDE - -#include -#include -#include "Exception.hpp" - -namespace gpstk -{ - /// Natural log of the gamma function for positive argument. - /// Gamma(x) = integral(0 to inf) { t^(x-1) exp(-t) dt } - /// @param x double argument, x must be > 0 - /// @return double ln(gamma(x)), the natural log of the gamma function of x. - /// @throw if the input argument is <= 0 - double lnGamma(const double& x) throw(Exception) - { - static const double con[8] = { - 76.18009172947146, -86.50532032941677, 24.01409824083091, - -1.231739572450155, 1.208650973866179e-3, -5.395239384953e-6, - 1.000000000190015, 2.5066282746310005 }; - if(x <= 0) { - Exception e("Non-positive argument in lnGamma()"); - GPSTK_THROW(e); - } - double y(x); - double t(x+5.5); - t -= (x+0.5) * ::log(t); - double s(con[6]); - for(int i=0; i<=5; i++) s += con[i] / ++y; - return (-t + ::log(con[7]*s/x)); - } - - /// Factorial of an integer, returned as a double. - /// @param n int argument, n must be >= 0 - /// @return n! or factorial(n), as a double - /// @throw if the input argument is < 0 - double factorial(const int& n) throw(Exception) - { - if(n < 0) { - Exception e("Negative argument in factorial()"); - GPSTK_THROW(e); - } - - if(n > 32) return ::exp(lnGamma(double(n+1))); - - static double store[33] = { 1.0, 1.0, 2.0, 6.0, 24.0, 120.0 }; - static int nstore=5; - - while(nstore < n) { - int i = nstore++; - store[nstore] = store[i] * nstore; - } - - return store[n]; - } - - /// ln of Factorial of an integer, returned as a double. - /// @param n int argument, n must be >= 0 - /// @return ln(n!) or natural log of factorial(n), as a double - /// @throw if the input argument is < 0 - double lnFactorial(const int& n) throw(Exception) - { - if(n < 0) { - Exception e("Negative argument in lnFactorial()"); - GPSTK_THROW(e); - } - if(n <= 1) return 0.0; - return lnGamma(double(n+1)); - } - - /// Binomial coefficient (n k) = n!/[k!(n-k)!], 0 <= k <= n. - /// (n k) is the number of combinations of n things taken k at a time. - /// NB. (n+1 k) = [ (n+1)/(n-k+1) ] (n k) = (n k) + (n k-1) - /// NB. (n k+1) = [ (n-k)/(k+1) ] (n k) - /// @param n int n must be >= 0 - /// @param k int k must be >= 0 and >= n - /// @return (n k), the binomial coefficient - /// @throw if the input argument do not satisfy 0 <= k <= n - double binomialCoeff(const int& n, const int& k) throw(Exception) - { - if(n < 0 || k > n) { - Exception e("Invalid arguments in binomialCoeff()"); - GPSTK_THROW(e); - } - - if(n <= 32) - return (factorial(n) / (factorial(k)*factorial(n-k))); - - return floor(0.5 + ::exp(lnFactorial(n)-lnFactorial(k)-lnFactorial(n-k))); - } - - /// Beta function. Beta(x,y)=Beta(y,x)=integral(0 to 1) {t^(x-1)*(1-t)^(y-1) dt}. - /// Also, Beta(x,y) = gamma(x)*gamma(y)/gamma(x+y). - /// @param double x first argument - /// @param double y second argument - /// @return beta(x,y) - /// @throw if either input argument is <= 0 - double beta(const double& x, const double& y) throw(Exception) - { - try { - return ::exp(lnGamma(x) + lnGamma(y) - lnGamma(x+y)); - } - catch(Exception& e) { - e.addText("Called by beta(x,y)"); - GPSTK_RETHROW(e); - } - } - - /// Incomplete gamma function P(a,x), evaluated using series representation. - /// P(a,x) = (1/gamma(a)) integral (0 to x) { exp(-t) t^(a-1) dt } - /// @param double a first argument, a > 0 - /// @param double x second argument, x >= 0 - /// @return P(a,x) - /// @throw if input arguments have a <= 0 or x < 0 - double seriesIncompGamma(const double& a, const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in seriesIncompGamma()"); - GPSTK_THROW(e); - } - if(a <= 0) { - Exception e("Non-positive second argument in seriesIncompGamma()"); - GPSTK_THROW(e); - } - - double lngamma(lnGamma(a)); - - static const int imax(100); - static const double eps(10*std::numeric_limits().epsilon()); - - double atmp(a),sum(1.0/a); - double del(sum); - for(int i=1; i<=imax; i++) { - ++atmp; - del *= x/atmp; - sum += del; - if(::fabs(del) < ::fabs(sum)*eps) - return (sum * ::exp(-x + a * ::log(x) - lngamma)); - } - Exception e("Overflow in seriesIncompGamma; first arg too big"); - GPSTK_THROW(e); - - return 0.0; - } - - /// Incomplete gamma function Q(a,x), evaluated using continued fractions. - /// Q(a,x) = (1/gamma(a)) integral (x to inf) { exp(-t) t^(a-1) dt } - /// @param double a first argument, a > 0 - /// @param double x second argument, x >= 0 - /// @return Q(a,x) - /// @throw if input arguments have a <= 0 or x < 0 - double contfracIncompGamma(const double& a, const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in contfracIncompGamma()"); - GPSTK_THROW(e); - } - if(a <= 0) { - Exception e("Non-positive second argument in contfracIncompGamma()"); - GPSTK_THROW(e); - } - - double lngamma(lnGamma(a)); - - static const int imax(100); - static const double eps(10*std::numeric_limits().epsilon()); - static const double fpmin(10*std::numeric_limits().min()); - - double b(x+1.0-a),c(1.0/fpmin); - double d(1.0/b); - double h(d); - int i; - for(i=1; i<=imax; i++) { - double an(-i*(i-a)); - b += 2.0; - d = an*d+b; - if(::fabs(d) < fpmin) d=fpmin; - c = b+an/c; - if(::fabs(c) < fpmin) c=fpmin; - d = 1.0/d; - double del(d*c); - h *= del; - if(::fabs(del-1.0) < eps) break; - } - if(i > imax) { - Exception e("Overflow in contfracIncompGamma; first arg too big"); - GPSTK_THROW(e); - } - - return (::exp(-x + a * ::log(x) - lngamma) * h); - } - - /// Incomplete gamma function P(a,x), a,x > 0. - /// P(a,x) = (1/gamma(a)) integral (0 to x) { exp(-t) t^(a-1) dt }; a > 0, x >= 0 - /// @param double a first argument, a > 0 - /// @param double x second argument, x >= 0 - /// @return P(a,x) - /// @throw if input arguments have a <= 0 or x < 0 - double incompGamma(const double& a, const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in incompGamma()"); - GPSTK_THROW(e); - } - if(a <= 0) { - Exception e("Non-positive second argument in incompGamma()"); - GPSTK_THROW(e); - } - - if(x < a+1.0) - return seriesIncompGamma(a,x); - else - return (1.0 - contfracIncompGamma(a,x)); - } - - /// Complement of incomplete gamma function Q(a,x), a > 0, x >= 0. - /// Q(a,x) = (1/gamma(a)) integral (x to inf) { exp(-t) t^(a-1) dt } - /// @param double a first argument, a > 0 - /// @param double x second argument, x >= 0 - /// @return Q(a,x) - /// @throw if input arguments have a <= 0 or x < 0 - double compIncompGamma(const double& a, const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in compIncompGamma()"); - GPSTK_THROW(e); - } - if(a <= 0) { - Exception e("Non-positive second argument in compIncompGamma()"); - GPSTK_THROW(e); - } - - if(x < a+1.0) - return (1.0 - seriesIncompGamma(a,x)); - else - return contfracIncompGamma(a,x); - } - - /// Error function erf(x). erf(x) = 2/sqrt(pi) * integral (0 to x) { exp(-t^2) dt } - /// @param double x input argument - /// @return erf(x) - double errorFunc(const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in errorFunc()"); - GPSTK_THROW(e); - } - try { - return (x < 0.0 ? -incompGamma(0.5,x*x) : incompGamma(0.5,x*x)); - } - catch(Exception& e) { - e.addText("Called by errorFunc()"); - GPSTK_RETHROW(e); - } - } - - /// Complementary error function erfc(x). erfc(x) = 1-erf(x) - /// @param double x input argument - /// @return erfc(x) - double compErrorFunc(const double& x) throw(Exception) - { - if(x < 0) { - Exception e("Negative first argument in compErrorFunc()"); - GPSTK_THROW(e); - } - try { - return (x < 0.0 ? 1.0+incompGamma(0.5,x*x) : compIncompGamma(0.5,x*x)); - } - catch(Exception& e) { - e.addText("Called by compErrorFunc()"); - GPSTK_RETHROW(e); - } - } - - /// Chi-square probability function. ChisqProbability(xsq,n) is defined as the - /// probability that the observed chi-squared for a correct model with n degrees - /// of freedom should be less than the value xsq. - /// @param double xsq input value for chi-squared, xsq > 0 - /// @param int n input value for number of degrees of freedom, n > 0 - /// @return Chi-squared probability (xsq,n) - double ChisqProbability(const double& x, const int& n) throw(Exception) - { - if(x <= 0) { - Exception e("Non-positive chi-sq argument in ChisqProbability()"); - GPSTK_THROW(e); - } - if(n < 0) { - Exception e("Non-positive degrees of freedom in ChisqProbability()"); - GPSTK_THROW(e); - } - - return incompGamma(double(n)/2.0,x/2.0); - } - - /// Complementary chi-square probability function. CompChisqProbability(xsq,n) is - /// defined as the probability that the observed chi-squared with n degrees of - /// freedom will exceed the value xsq even for a correct model. - /// @param double xsq input value for chi-squared, xsq > 0 - /// @param int n input value for number of degrees of freedom, n > 0 - /// @return Complementary chi-squared probability (xsq,n) - double CompChisqProbability(const double& x, const int& n) throw(Exception) - { - if(x <= 0) { - Exception e("Non-positive chi-sq argument in CompChisqProbability()"); - GPSTK_THROW(e); - } - if(n < 0) { - Exception e("Non-positive degrees of freedom in CompChisqProbability()"); - GPSTK_THROW(e); - } - - return compIncompGamma(double(n)/2.0,x/2.0); - } - - // Compute continued fractions portion of incomplete beta function I_x(a,b) - /// Routine used internally for Incomplete beta function I_x(a,b) - double cfIBeta(const double& x, const double& a, const double& b) throw(Exception) - { - static const int imax(100); - static const double eps(10*std::numeric_limits().epsilon()); - static const double fpmin(10*std::numeric_limits().min()); - const double qab(a+b); - const double qap(a+1.0); - const double qam(a-1.0); - double c(1),d(1-qab*x/qap),aa,del; - if(::fabs(d) < fpmin) d=fpmin; - d = 1.0/d; - double h(d); - int i,i2; - for(i=1; i<=imax; i++) { - i2 = 2*i; - aa = i*(b-i)*x/((qam+i2)*(a+i2)); - d = 1.0 + aa*d; - if(::fabs(d) < fpmin) d=fpmin; - c = 1.0 + aa/c; - if(::fabs(c) < fpmin) c=fpmin; - d = 1.0/d; - h *= d*c; - aa = -(a+i)*(qab+i)*x/((a+i2)*(qap+i2)); - d = 1.0 + aa*d; - if(::fabs(d) < fpmin) d=fpmin; - c = 1.0 + aa/c; - if(::fabs(c) < fpmin) c=fpmin; - d = 1.0/d; - del = d*c; - h *= del; - if(::fabs(del-1.0) < eps) break; - } - if(i > imax) { - Exception e("Overflow in cfIBeta(); a or b too big"); - GPSTK_THROW(e); - } - return h; - } - - /// Incomplete beta function I_x(a,b), 0<=x<=1, a,b>0 - /// I sub x (a,b) = (1/beta(a,b)) integral (0 to x) { t^(a-1)*(1-t)^(b-1)dt } - /// @param double x input value, 0 <= x <= 1 - /// @param double a input value, a > 0 - /// @param double b input value, b > 0 - /// @return Incomplete beta function I_x(a,b) - double incompleteBeta(const double& x, const double& a, const double& b) - throw(Exception) - { - if(x < 0 || x > 1) { - Exception e("Invalid x argument in incompleteBeta()"); - GPSTK_THROW(e); - } - if(a <= 0 || b <= 0) { - Exception e("Non-positive argument in incompleteBeta()"); - GPSTK_THROW(e); - } - - if(x == 0) return 0.0; - if(x == 1) return 1.0; - - try { - double factor = ::exp(lnGamma(a+b) - lnGamma(a) - lnGamma(b) - + a * ::log(x) + b * ::log(1.0-x)); - if(x < (a+1.0)/(a+b+2.0)) - return factor*cfIBeta(x,a,b)/a; - else - return 1.0-factor*cfIBeta(1.0-x,b,a)/b; - } - catch(Exception& e) { - e.addText("Called by incompleteBeta()"); - GPSTK_RETHROW(e); - } - } - - /// Student's distribution probability function S(t,n), for n degrees of freedom. - /// Student's distribution probability is used in the test of whether two observed - /// distributions have the same mean. S(t,n) is the probability, for n degrees of - /// freedom, that a statistic t (measuring the observed difference of means) - /// would be smaller than the observed value if the means were in fact the same. - /// Two means are significantly different if, e.g. S(t,n) > 0.99; - /// in other words 1-S(t,n) is the significance level at which the hypothesis - /// that the means are equal is disproved. - /// @param double t input statistic value - /// @param int n degrees of freedom, n > 0 - /// @return Student's distribution probability P(t,n) - double StudentsDistProbability(const double& t, const int& n) throw(Exception) - { - if(n <= 0) { - Exception e("Non-positive degrees of freedom in StudentsDistribution()"); - GPSTK_THROW(e); - } - - return (1.0 - incompleteBeta(double(n)/(t*t+double(n)),double(n)/2,0.5)); - } - - /// F distribution probability function F(f,n1,n2), f>=0, n1,n2>0 - /// This function occurs in the statistical test of whether two observed samples - /// have the same variance. If f is the ratio of the observed dispersion of the - /// first sample to that of the second one, where the first sample has n1 degrees - /// of freedom and the second has n2 degrees of freedom, then this function - /// returns the probability that f would be as large as it is if the first - /// sample's distribution has smaller variance than the second's. In other words, - /// FDistribution(f,n1,n2) is the significance level at which the hypothesis - /// "sample 1 has smaller variance than sample 2" can be rejected. - /// A small numerical value implies a significant rejection, in turn implying - /// high confidence in the hypothesis "sample 1 has variance greater than or equal - /// to that of sample 2". - /// @param double f input statistic value, the ratio variance1/variance2, f >= 0 - /// @param int n1 degrees of freedom of first sample, n1 > 0 - /// @param int n2 degrees of freedom of second sample, n2 > 0 - /// @return F distribution F(f,n1,n2) - double FDistProbability(const double& f, const int& n1, const int& n2) - throw(Exception) - { - if(f < 0) { - Exception e("Negative statistic in FDistribution()"); - GPSTK_THROW(e); - } - if(n1 <= 0 || n2 <= 0) { - Exception e("Non-positive degrees of freedom in FDistribution()"); - GPSTK_THROW(e); - } - - return incompleteBeta(double(n2)/(double(n2)+double(n1)*f), - double(n2)/2.0,double(n1)/2.0); - } - -} // end namespace - -#endif // SPECIAL_FUNCTIONS_INCLUDE diff --git a/ext/lib/Geomatics/SunEarthSatGeometry.cpp b/ext/lib/Geomatics/SunEarthSatGeometry.cpp index 4a70bcbff..4ad8c0e9d 100644 --- a/ext/lib/Geomatics/SunEarthSatGeometry.cpp +++ b/ext/lib/Geomatics/SunEarthSatGeometry.cpp @@ -67,7 +67,7 @@ try { return R; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -119,7 +119,7 @@ try { return R; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -168,7 +168,7 @@ try { return R; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -237,7 +237,7 @@ try { return shadow; } catch(Exception& e) { GPSTK_RETHROW(e); } -catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } +catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -326,7 +326,7 @@ Matrix doSatAtt(const CommonTime& tt, const Position& SV, return R; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) {Exception E("std except: "+string(e.what())); GPSTK_THROW(E);} + catch(std::exception& e) {Exception E("std except: "+string(e.what())); GPSTK_THROW(E);} catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -403,7 +403,7 @@ void SatelliteNadirAzimuthAngles(const Position& SV, if(azimuth < 0.0) azimuth += 360.; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) {Exception E("std except: "+string(e.what())); GPSTK_THROW(E);} + catch(std::exception& e) {Exception E("std except: "+string(e.what())); GPSTK_THROW(E);} catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } } @@ -432,7 +432,7 @@ double SatelliteEarthSunAngle(const Position& Sat, const Position& Sun) return (::acos(sat.dot(ssun))); } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: " + string(e.what())); GPSTK_THROW(E); } @@ -504,7 +504,7 @@ void SunOrbitAngles(const Position& Pos, const Position& Vel, const Position& Su phi = 0.0; } catch(Exception& e) { GPSTK_RETHROW(e); } - catch(exception& e) { + catch(std::exception& e) { Exception E("std except: " + string(e.what())); GPSTK_THROW(E); } diff --git a/ext/lib/Math/SimpleKalmanFilter.cpp b/ext/lib/Math/SimpleKalmanFilter.cpp index 56e3d6a33..7a4dc62bb 100644 --- a/ext/lib/Math/SimpleKalmanFilter.cpp +++ b/ext/lib/Math/SimpleKalmanFilter.cpp @@ -347,7 +347,7 @@ namespace gpstk // Create dummy matrices and vectors and call the full // Predict() method - int stateRow(previousState.size()); + size_t stateRow(previousState.size()); Matrix dummyControMatrix(stateRow,1,0.0); Vector dummyControlInput(1,0.0); @@ -422,16 +422,16 @@ namespace gpstk throw(InvalidSolver) { // Let's check sizes before start - int aposterioriStateRow(xhat.size()); - int controlInputRow(controlInput.size()); + size_t aposterioriStateRow(xhat.size()); + size_t controlInputRow(controlInput.size()); - int phiCol(phiMatrix.cols()); - int phiRow(phiMatrix.rows()); + size_t phiCol(phiMatrix.cols()); + size_t phiRow(phiMatrix.rows()); - int controlCol(controlMatrix.cols()); - int controlRow(controlMatrix.rows()); + size_t controlCol(controlMatrix.cols()); + size_t controlRow(controlMatrix.rows()); - int processNoiseRow(processNoiseCovariance.rows()); + size_t processNoiseRow(processNoiseCovariance.rows()); if ( phiCol != phiRow ) { @@ -514,16 +514,16 @@ process noise covariance matrix do not match."); throw(InvalidSolver) { // Let's check sizes before start - int measRow(measurements.size()); - int aprioriStateRow(xhatminus.size()); + size_t measRow(measurements.size()); + size_t aprioriStateRow(xhatminus.size()); - int mMRow(measurementsMatrix.rows()); + size_t mMRow(measurementsMatrix.rows()); - int mNCCol(measurementsNoiseCovariance.cols()); - int mNCRow(measurementsNoiseCovariance.rows()); + size_t mNCCol(measurementsNoiseCovariance.cols()); + size_t mNCRow(measurementsNoiseCovariance.rows()); - int pMCol(Pminus.cols()); - int pMRow(Pminus.rows()); + size_t pMCol(Pminus.cols()); + size_t pMRow(Pminus.rows()); if ( ( mNCCol != mNCRow ) || ( pMCol != pMRow ) ) diff --git a/ext/lib/PosSol/PRSolution.cpp b/ext/lib/PosSol/PRSolution.cpp index 201573aee..31f4faed3 100644 --- a/ext/lib/PosSol/PRSolution.cpp +++ b/ext/lib/PosSol/PRSolution.cpp @@ -240,7 +240,7 @@ namespace gpstk } // dimension of the solution vector (3 pos + 1 clk/sys) - const int dim(3 + mySyss.size()); + const size_t dim(3 + mySyss.size()); if(dim > 4) Mixed = true; // require number of good satellites to be >= number unknowns (no RAIM here) diff --git a/ext/lib/PosSol/PRSolution.hpp b/ext/lib/PosSol/PRSolution.hpp index d9d49e6df..15860fdf1 100644 --- a/ext/lib/PosSol/PRSolution.hpp +++ b/ext/lib/PosSol/PRSolution.hpp @@ -195,6 +195,7 @@ namespace gpstk nsol = ndata = 0; APV = 0.0; was.reset(); + APSolution = Vector(4,0.0); } /// Define the systems, including their order, that will be in the apriori sol diff --git a/ext/lib/Procframe/CodeKalmanSolver.cpp b/ext/lib/Procframe/CodeKalmanSolver.cpp index 4cb25ddca..0c5c0ef71 100644 --- a/ext/lib/Procframe/CodeKalmanSolver.cpp +++ b/ext/lib/Procframe/CodeKalmanSolver.cpp @@ -391,7 +391,7 @@ covariance matrix."); satTypeValueMap dummy(gData.body.extractTypeID(TypeID::weight)); // Count the number of satellites with weights - int nW(dummy.numSats()); + size_t nW(dummy.numSats()); for (int i=0; i(&ffs)) { @@ -245,7 +245,7 @@ namespace gpstk try { strm.read((char *)p2, 1); } - catch(exception& e) { + catch(std::exception& e) { if(debug) cout << "read 1 threw std exception: " << e.what() << endl; //FFStreamError fe(string("std exception: ")+e.what()); //GPSTK_THROW(fe); @@ -527,7 +527,7 @@ namespace gpstk catch(Exception e) { if(debug) cout << "reallyGetRecord caught GPSTK exception " << e << endl; } - catch(exception e) { + catch(std::exception e) { if(debug) cout << "reallyGetRecord caught std exception " << e.what() << endl; } catch(...) { diff --git a/ext/tests/CMakeLists.txt b/ext/tests/CMakeLists.txt index 871a27c19..112c5366c 100755 --- a/ext/tests/CMakeLists.txt +++ b/ext/tests/CMakeLists.txt @@ -11,7 +11,6 @@ #add_subdirectory (JulianDate) #add_subdirectory (Matrix) #add_subdirectory (MJD) -#add_subdirectory (MSC) #add_subdirectory (PolyFit) #add_subdirectory (PowerSum) #add_subdirectory (RACRotation) diff --git a/ext/tests/Jamfile b/ext/tests/Jamfile deleted file mode 100755 index f80cf4cea..000000000 --- a/ext/tests/Jamfile +++ /dev/null @@ -1,31 +0,0 @@ -SubDir TOP ; -SubInclude TOP ANSITime ; -SubInclude TOP BinUtils ; -SubInclude TOP CivilTime ; -SubInclude TOP CommonTime ; -SubInclude TOP gpsNavMsg ; -SubInclude TOP GPSWeekSecond ; -SubInclude TOP GPSWeekZcount ; -#SubInclude TOP HelmertTransform ; -SubInclude TOP IonoModel ; -SubInclude TOP JulianDate ; -SubInclude TOP Matrix ; -SubInclude TOP MJD ; -SubInclude TOP MSC ; -SubInclude TOP PolyFit ; -SubInclude TOP PowerSum ; -SubInclude TOP RACRotation ; -SubInclude TOP ReferenceFrame ; -SubInclude TOP RinexEphemerisStore ; -SubInclude TOP RinexMet ; -SubInclude TOP RinexNav ; -SubInclude TOP RinexObs ; -SubInclude TOP RungeKutta4 ; -SubInclude TOP SP3EphemerisStore ; -SubInclude TOP Stats ; -SubInclude TOP TimeConverters ; -SubInclude TOP UnixTime ; -SubInclude TOP Vector ; -SubInclude TOP YDSTime ; -SubInclude TOP Yuma ; -SubInclude TOP SEM ; diff --git a/ext/tests/Jamrules b/ext/tests/Jamrules deleted file mode 100755 index dd6c929f2..000000000 --- a/ext/tests/Jamrules +++ /dev/null @@ -1,22 +0,0 @@ -PATH_TO_CURRENT = /home/cummins/svn/r2/Release20/Release20/tests ; #Current directory; Main testing directory -CPPUNIT_LIB = /usr/local/lib ; #Directory which holds the CppUnit Libraries -CPPUNIT_INC = /usr/local/include/cppunit ; #Directory which holds the CppUnit include files - -STD_LINK_LIBS = -ldl -lstdc++ ; -LINKFLAGS = -fprofile-arcs -ftest-coverage ; #Gcov required flags -SEARCH = $(CPPUNIT_LIB) $(PATH_TO_CURRENT)/../src ; - -rule Clean -{ - RM = rm *.g* */*.g* ; -} - -rule TestMain -{ - Main $(PATH_TO_CURRENT)/$(<) : $(PATH_TO_CURRENT)/$(>) ; - ObjectHdrs $(PATH_TO_CURRENT)/$(<) $(PATH_TO_CURRENT)/$(>) : $(CPPUNIT_INC) $(PATH_TO_CURRENT)/../src ; - ObjectC++Flags $(PATH_TO_CURRENT)/$(>) : -fprofile-arcs -ftest-coverage ; - LINKLIBS on $(PATH_TO_CURRENT)/$(<) = $(STD_LINK_LIBS) ; - LinkLibraries $(PATH_TO_CURRENT)/$(<) : libcppunit $(PATH_TO_CURRENT)/../src/libgpstk ; - -} diff --git a/ext/tests/MSC/Jamfile b/ext/tests/MSC/Jamfile deleted file mode 100755 index 219c5aa10..000000000 --- a/ext/tests/MSC/Jamfile +++ /dev/null @@ -1,2 +0,0 @@ -SubDir TOP MSC ; -TestMain MSC/xMSC.tst : MSC/xMSCM.cpp MSC/xMSC.cpp MSC/MSCData.cpp MSC/MSCStream.cpp ; diff --git a/ext/tests/MSC/Logs/CoordFile b/ext/tests/MSC/Logs/CoordFile deleted file mode 100755 index ce822fc30..000000000 --- a/ext/tests/MSC/Logs/CoordFile +++ /dev/null @@ -1,5 +0,0 @@ -200136011111AAA 2001 001 000002001 001 00000-1111111.295-2222222.239 3333333.175-0.0111 0.0222-0.0333 -200136022222BBB 2001 001 000002001 001 00000 2222222.122-3333333.853 -444444.990-0.0000-0.0000 0.0112 -200136033333CCC 2001 001 000002001 001 00000 3333333.142 2727272.007 -0.366-0.0000 0.0000 0.0227 -200136044444DDD 2001 001 000002001 001 00000-4444444.370 3434343.965 111111.071 0.0000 0.0000 0.0110 -200136055555EEE 2001 001 000002001 001 00000 -0.484 -0.093 0.952-0.0000 0.0000 0.0000 diff --git a/ext/tests/MSC/Logs/CoordFileOld b/ext/tests/MSC/Logs/CoordFileOld deleted file mode 100755 index adad0ed63..000000000 --- a/ext/tests/MSC/Logs/CoordFileOld +++ /dev/null @@ -1,5 +0,0 @@ -200136011111AAA 2001.002001.00-1111111.295-2222222.239 3333333.175 -.0111 .0222 -.0333 -200136022222BBB 2001.002001.00 2222222.122-3333333.853 -444444.990 -.0000 -.0000 .0112 -200136033333CCC 2001.002001.00 3333333.142 2727272.007 -0.366 -.0000 .0000 .0227 -200136044444DDD 2001.002001.00-4444444.370 3434343.965 111111.071 .0000 .0000 .0110 -200136055555EEE 2001.002001.00 -0.484 -0.093 0.952 -.0000 .0000 .0000 diff --git a/ext/tests/MSC/Logs/Output b/ext/tests/MSC/Logs/Output deleted file mode 100755 index ce822fc30..000000000 --- a/ext/tests/MSC/Logs/Output +++ /dev/null @@ -1,5 +0,0 @@ -200136011111AAA 2001 001 000002001 001 00000-1111111.295-2222222.239 3333333.175-0.0111 0.0222-0.0333 -200136022222BBB 2001 001 000002001 001 00000 2222222.122-3333333.853 -444444.990-0.0000-0.0000 0.0112 -200136033333CCC 2001 001 000002001 001 00000 3333333.142 2727272.007 -0.366-0.0000 0.0000 0.0227 -200136044444DDD 2001 001 000002001 001 00000-4444444.370 3434343.965 111111.071 0.0000 0.0000 0.0110 -200136055555EEE 2001 001 000002001 001 00000 -0.484 -0.093 0.952-0.0000 0.0000 0.0000 diff --git a/ext/tests/MSC/Logs/Output2 b/ext/tests/MSC/Logs/Output2 deleted file mode 100755 index ce822fc30..000000000 --- a/ext/tests/MSC/Logs/Output2 +++ /dev/null @@ -1,5 +0,0 @@ -200136011111AAA 2001 001 000002001 001 00000-1111111.295-2222222.239 3333333.175-0.0111 0.0222-0.0333 -200136022222BBB 2001 001 000002001 001 00000 2222222.122-3333333.853 -444444.990-0.0000-0.0000 0.0112 -200136033333CCC 2001 001 000002001 001 00000 3333333.142 2727272.007 -0.366-0.0000 0.0000 0.0227 -200136044444DDD 2001 001 000002001 001 00000-4444444.370 3434343.965 111111.071 0.0000 0.0000 0.0110 -200136055555EEE 2001 001 000002001 001 00000 -0.484 -0.093 0.952-0.0000 0.0000 0.0000 diff --git a/ext/tests/MSC/MSCData.cpp b/ext/tests/MSC/MSCData.cpp deleted file mode 100644 index 2fc4c37a0..000000000 --- a/ext/tests/MSC/MSCData.cpp +++ /dev/null @@ -1 +0,0 @@ -../../src/MSCData.cpp \ No newline at end of file diff --git a/ext/tests/MSC/MSCData.hpp b/ext/tests/MSC/MSCData.hpp deleted file mode 100644 index d90f9d844..000000000 --- a/ext/tests/MSC/MSCData.hpp +++ /dev/null @@ -1 +0,0 @@ -../../src/MSCData.hpp \ No newline at end of file diff --git a/ext/tests/MSC/MSCStream.cpp b/ext/tests/MSC/MSCStream.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/ext/tests/MSC/MSCStream.hpp b/ext/tests/MSC/MSCStream.hpp deleted file mode 100644 index c647d3397..000000000 --- a/ext/tests/MSC/MSCStream.hpp +++ /dev/null @@ -1 +0,0 @@ -../../src/MSCStream.hpp \ No newline at end of file diff --git a/ext/tests/MSC/xMSC.cpp b/ext/tests/MSC/xMSC.cpp deleted file mode 100644 index 495f67766..000000000 --- a/ext/tests/MSC/xMSC.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -#include "xMSC.hpp" - -CPPUNIT_TEST_SUITE_REGISTRATION (xMSC); - -using namespace gpstk; - -void xMSC :: setUp (void) -{ -} - -void xMSC :: firstTest (void) -{ - MSCStream Input("Logs/CoordFile"); - MSCStream Out("Logs/Output",ios::out); - MSCData Data; - - Input >> Data; - gpstk::YDSTime Time(2001L,360L,0.0,TimeSystem::Unknown); - CPPUNIT_ASSERT_EQUAL(Time,Data.time); - CPPUNIT_ASSERT_EQUAL((long unsigned) 11111,Data.station); - CPPUNIT_ASSERT_EQUAL((string)"AAA " ,Data.mnemonic); - - Out << Data; - while (Input >> Data) - { - Out << Data; - } - - MSCStream Input2("Logs/Output"); - MSCStream Out2("Logs/Output2",ios::out); - MSCData Data2; - while (Input2 >> Data2) - { - Out2 << Data2; - } - CPPUNIT_ASSERT(fileEqualTest("Logs/CoordFile","Logs/Output")); - CPPUNIT_ASSERT(fileEqualTest("Logs/CoordFile","Logs/Output2")); -} - -bool xMSC :: fileEqualTest (const char* handle1, const char* handle2) -{ - bool isEqual = false; - - ifstream File1; - ifstream File2; - - std::string File1Line; - std::string File2Line; - - File1.open(handle1); - File2.open(handle2); - - while (!File1.eof()) - { - if (File2.eof()) - return isEqual; - getline (File1, File1Line); - getline (File2, File2Line); - - if (File1Line != File2Line) - return isEqual; - } - if (!File2.eof()) - return isEqual; - else - return isEqual = true; -} diff --git a/ext/tests/MSC/xMSC.hpp b/ext/tests/MSC/xMSC.hpp deleted file mode 100644 index 9197fa160..000000000 --- a/ext/tests/MSC/xMSC.hpp +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -#ifndef XMSC_HPP -#define XMSC_HPP - -#include -#include -#include "MSCData.hpp" -#include "MSCStream.hpp" -#include "YDSTime.hpp" -#include "CommonTime.hpp" - -using namespace std; - -class xMSC: public CPPUNIT_NS :: TestFixture -{ - CPPUNIT_TEST_SUITE (xMSC); - CPPUNIT_TEST (firstTest); - CPPUNIT_TEST_SUITE_END (); - - public: - void setUp (void); - - protected: - void firstTest (void); - bool fileEqualTest (const char*, const char*); - - private: - -}; - -#endif diff --git a/ext/tests/MSC/xMSCM.cpp b/ext/tests/MSC/xMSCM.cpp deleted file mode 100644 index efb568777..000000000 --- a/ext/tests/MSC/xMSCM.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -// CppUnit-Tutorial -// file: ftest.cc -#include -#include -#include -#include -#include - -int main (int argc, char* argv[]) -{ - - // informs test-listener about testresults - CPPUNIT_NS :: TestResult testresult; - - // register listener for collecting the test-results - CPPUNIT_NS :: TestResultCollector collectedresults; - testresult.addListener (&collectedresults); - - // insert test-suite at test-runner by registry - CPPUNIT_NS :: TestRunner testrunner; - testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ()); - testrunner.run (testresult); - - // output results in compiler-format - CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr); - compileroutputter.write (); - - // return 0 if tests were successful - return collectedresults.wasSuccessful () ? 0 : 1; -} diff --git a/ext/tests/Makefile.am b/ext/tests/Makefile.am deleted file mode 100755 index 1b64e5530..000000000 --- a/ext/tests/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# $Id: Makefile.am 3140 2012-06-18 15:03:02Z susancummins $ -SUBDIRS = ANSITime \ - BinUtils \ - CivilTime \ - CommonTime \ - gpsNavMsg \ - GPSWeekSecond \ - GPSWeekZcount \ - IonoModel \ - JulianDate \ - Matrix \ - MJD \ - MSC \ - PolyFit \ - PowerSum \ - RACRotation \ - RinexEphemerisStore \ - RinexMet \ - RinexNav \ - RinexObs \ - RungeKutta4 \ - SEM \ - Stats \ - TimeConverters \ - UnixTime \ - Vector \ - YDSTime \ - Yuma diff --git a/ext/tests/ReferenceFrame/Jamfile b/ext/tests/ReferenceFrame/Jamfile deleted file mode 100755 index f97773cae..000000000 --- a/ext/tests/ReferenceFrame/Jamfile +++ /dev/null @@ -1,2 +0,0 @@ -SubDir TOP ReferenceFrame ; -TestMain ReferenceFrame/ReferenceFrame.tst : ReferenceFrame/xReferenceFrameM.cpp ReferenceFrame/xReferenceFrame.cpp ReferenceFrame/ReferenceFrame.cpp ; diff --git a/ext/tests/ReferenceFrame/ReferenceFrame.cpp b/ext/tests/ReferenceFrame/ReferenceFrame.cpp deleted file mode 100644 index 06464d6fa..000000000 --- a/ext/tests/ReferenceFrame/ReferenceFrame.cpp +++ /dev/null @@ -1 +0,0 @@ -../../src/ReferenceFrame.cpp \ No newline at end of file diff --git a/ext/tests/ReferenceFrame/ReferenceFrame.hpp b/ext/tests/ReferenceFrame/ReferenceFrame.hpp deleted file mode 100644 index fffbd2a8c..000000000 --- a/ext/tests/ReferenceFrame/ReferenceFrame.hpp +++ /dev/null @@ -1 +0,0 @@ -../../src/ReferenceFrame.hpp \ No newline at end of file diff --git a/ext/tests/ReferenceFrame/xReferenceFrame.cpp b/ext/tests/ReferenceFrame/xReferenceFrame.cpp deleted file mode 100644 index b00755f19..000000000 --- a/ext/tests/ReferenceFrame/xReferenceFrame.cpp +++ /dev/null @@ -1,347 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2009, The University of Texas at Austin -// -//============================================================================ - -#include "xReferenceFrame.hpp" - -using namespace std; -using namespace gpstk; - -CPPUNIT_TEST_SUITE_REGISTRATION (xReferenceFrame); - -void xReferenceFrame::getFrameTest() -{ - ReferenceFrame rf1(0); - ReferenceFrame::FramesEnum frame1 = (ReferenceFrame::FramesEnum)0; - CPPUNIT_ASSERT(rf1.getFrame() == frame1); - - ReferenceFrame rf2(1); - ReferenceFrame::FramesEnum frame2 = (ReferenceFrame::FramesEnum)1; - CPPUNIT_ASSERT(rf2.getFrame() == frame2); - - ReferenceFrame rf3(2); - ReferenceFrame::FramesEnum frame3 = (ReferenceFrame::FramesEnum)2; - CPPUNIT_ASSERT(rf3.getFrame() == frame3); - - //Fails to ReferenceFrame::Unknown - ReferenceFrame rf4(-1); - ReferenceFrame::FramesEnum frame4 = (ReferenceFrame::FramesEnum)3; - CPPUNIT_ASSERT(rf4.getFrame() != frame4); - CPPUNIT_ASSERT(rf4.getFrame() == frame1); -} -void xReferenceFrame::asStringTest() -{ - string pz("PZ90"); - string wgs("WGS84"); - string unk("Unknown"); - - ReferenceFrame rf1(ReferenceFrame::PZ90); - CPPUNIT_ASSERT(rf1.asString() == pz); - - ReferenceFrame rf2(ReferenceFrame::WGS84); - CPPUNIT_ASSERT(rf2.asString() == wgs); - - ReferenceFrame rf3(ReferenceFrame::Unknown); - CPPUNIT_ASSERT(rf3.asString() == unk); -} -void xReferenceFrame::equalityTest() -{ - ReferenceFrame rf1(ReferenceFrame::PZ90); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::Unknown); - ReferenceFrame rf4("PZ90"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("Junk String That Will Never Match Up"); - - //PZ90 Enum with... - CPPUNIT_ASSERT(rf1 == rf1); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 == rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 == rf3 )); - CPPUNIT_ASSERT(rf1 == rf4); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 == rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 == rf6 )); - - //WGS84 Enum with... - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 == rf1 )); - CPPUNIT_ASSERT( rf2 == rf2); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 == rf3 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 == rf4 )); - CPPUNIT_ASSERT( rf2 == rf5); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 == rf6 )); - - //Unknown Enum with... (Should fail every one) - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 == rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 == rf2 )); - CPPUNIT_ASSERT( rf3 == rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 == rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 == rf5 )); - CPPUNIT_ASSERT( rf3 == rf6 ); -} -void xReferenceFrame::inequalityTest() -{ - ReferenceFrame rf1(ReferenceFrame::PZ90); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::Unknown); - ReferenceFrame rf4("PZ90"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("Junk String That Will Never Match Up"); - - //PZ90 Enum with... - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 != rf1 )); - CPPUNIT_ASSERT( rf1 != rf2 ); - CPPUNIT_ASSERT( rf1 != rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 != rf4 )); - CPPUNIT_ASSERT( rf1 != rf5 ); - CPPUNIT_ASSERT( rf1 != rf6 ); - - //WGS84 Enum with... - CPPUNIT_ASSERT( rf2 != rf1 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 != rf2 )); - CPPUNIT_ASSERT( rf2 != rf3 ); - CPPUNIT_ASSERT( rf2 != rf4 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 != rf5 )); - CPPUNIT_ASSERT( rf2 != rf6 ); - - //Unknown Enum with... - CPPUNIT_ASSERT( rf3 != rf1 ); - CPPUNIT_ASSERT( rf3 != rf2 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 != rf3 )); - CPPUNIT_ASSERT( rf3 != rf4 ); - CPPUNIT_ASSERT( rf3 != rf5 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 != rf6 )); -} -void xReferenceFrame::greaterThanTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - ReferenceFrame rf4("Junk String That Will Never Match Up"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("PZ90"); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf3 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 > rf6 )); - - CPPUNIT_ASSERT( rf2 > rf1 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf3 )); - CPPUNIT_ASSERT( rf2 > rf4 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 > rf6 )); - - CPPUNIT_ASSERT( rf3 > rf1 ); - CPPUNIT_ASSERT( rf3 > rf2 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 > rf3 )); - CPPUNIT_ASSERT( rf3 > rf4 ); - CPPUNIT_ASSERT( rf3 > rf5 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 > rf6 )); -} -void xReferenceFrame::lessThanTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - ReferenceFrame rf4("Junk String That Will Never Match Up"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("PZ90"); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 < rf1 )); - CPPUNIT_ASSERT( rf1 < rf2 ); - CPPUNIT_ASSERT( rf1 < rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf1 < rf4 )); - CPPUNIT_ASSERT( rf1 < rf5 ); - CPPUNIT_ASSERT( rf1 < rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf2 )); - CPPUNIT_ASSERT( rf2 < rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 < rf5 )); - CPPUNIT_ASSERT( rf2 < rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf2 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf3 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf5 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 < rf6 )); -} -void xReferenceFrame::greaterThanOrEqualToTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - ReferenceFrame rf4("Junk String That Will Never Match Up"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("PZ90"); - - //Unknown with... - CPPUNIT_ASSERT( rf1 >= rf1 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf2 ))); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf3 ))); - CPPUNIT_ASSERT( rf1 >= rf4 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf5 ))); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf1 >= rf6 ))); - - CPPUNIT_ASSERT( rf2 >= rf1 ); - CPPUNIT_ASSERT( rf2 >= rf2 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf2 >= rf3 ))); - CPPUNIT_ASSERT( rf2 >= rf4 ); - CPPUNIT_ASSERT( rf2 >= rf5 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT(( rf2 >= rf6 ))); - - CPPUNIT_ASSERT( rf3 >= rf1 ); - CPPUNIT_ASSERT( rf3 >= rf2 ); - CPPUNIT_ASSERT( rf3 >= rf3 ); - CPPUNIT_ASSERT( rf3 >= rf4 ); - CPPUNIT_ASSERT( rf3 >= rf5 ); - CPPUNIT_ASSERT( rf3 >= rf6 ); -} -void xReferenceFrame::lesserThanOrEqualToTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - ReferenceFrame rf4("Junk String That Will Never Match Up"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("PZ90"); - - CPPUNIT_ASSERT( rf1 <= rf1 ); - CPPUNIT_ASSERT( rf1 <= rf2 ); - CPPUNIT_ASSERT( rf1 <= rf3 ); - CPPUNIT_ASSERT( rf1 <= rf4 ); - CPPUNIT_ASSERT( rf1 <= rf5 ); - CPPUNIT_ASSERT( rf1 <= rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 <= rf1 )); - CPPUNIT_ASSERT( rf2 <= rf2 ); - CPPUNIT_ASSERT( rf2 <= rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf2 <= rf4 )); - CPPUNIT_ASSERT( rf2 <= rf5 ); - CPPUNIT_ASSERT( rf2 <= rf6 ); - - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf1 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf2 )); - CPPUNIT_ASSERT( rf3 <= rf3 ); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf4 )); - CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT( rf3 <= rf5 )); - CPPUNIT_ASSERT( rf3 <= rf6 ); -} -void xReferenceFrame::setReferenceFrameTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - - ReferenceFrame frame(ReferenceFrame::Unknown); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame(0); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame("Unknown"); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame("A Junk String that won't match up"); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame(-1); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame((ReferenceFrame::FramesEnum)-1); - CPPUNIT_ASSERT(frame == rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame(ReferenceFrame::WGS84); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame("WGS84"); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame(1); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame == rf2); - CPPUNIT_ASSERT(frame != rf3); - - frame = ReferenceFrame(ReferenceFrame::PZ90); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); - - frame = ReferenceFrame("PZ90"); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); - - frame = ReferenceFrame(2); - CPPUNIT_ASSERT(frame != rf1); - CPPUNIT_ASSERT(frame != rf2); - CPPUNIT_ASSERT(frame == rf3); -} -void xReferenceFrame::createReferenceFrameTest() -{ - ReferenceFrame rf1(ReferenceFrame::Unknown); - ReferenceFrame rf2(ReferenceFrame::WGS84); - ReferenceFrame rf3(ReferenceFrame::PZ90); - ReferenceFrame rf4("Junk String That Will Never Match Up"); - ReferenceFrame rf5("WGS84"); - ReferenceFrame rf6("PZ90"); - - ReferenceFrame test; - test = test.createReferenceFrame("PZ90"); - //We want it to assert that test is the same as rf6 and rf3 - CPPUNIT_ASSERT(test == rf3); - CPPUNIT_ASSERT(test == rf6); - CPPUNIT_ASSERT(test != rf1); - - //Made up string - test = test.createReferenceFrame("ZP84"); - CPPUNIT_ASSERT(test != rf1); - CPPUNIT_ASSERT(test != rf2); - CPPUNIT_ASSERT(test != rf3); - CPPUNIT_ASSERT(test != rf4); - CPPUNIT_ASSERT(test != rf5); - CPPUNIT_ASSERT(test != rf6); - - //Make a new frame of type zp84 - ReferenceFrame test1("ZP84"); - CPPUNIT_ASSERT(test == test1); - CPPUNIT_ASSERT(test1 != rf1); -} diff --git a/ext/tests/ReferenceFrame/xReferenceFrame.hpp b/ext/tests/ReferenceFrame/xReferenceFrame.hpp deleted file mode 100644 index 33174139b..000000000 --- a/ext/tests/ReferenceFrame/xReferenceFrame.hpp +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -#ifndef X_REFERENCE_FRAME_HPP -#define X_REFERENCE_FRAME_HPP - -#include -#include -#include "ReferenceFrame.hpp" -namespace gpstk{ - class xReferenceFrame : public CPPUNIT_NS :: TestFixture - { - CPPUNIT_TEST_SUITE (xReferenceFrame); - CPPUNIT_TEST (getFrameTest); - CPPUNIT_TEST (asStringTest); - CPPUNIT_TEST (equalityTest); - CPPUNIT_TEST (inequalityTest); - CPPUNIT_TEST (greaterThanTest); - CPPUNIT_TEST (greaterThanOrEqualToTest); - CPPUNIT_TEST (lessThanTest); - CPPUNIT_TEST (lesserThanOrEqualToTest); - CPPUNIT_TEST (setReferenceFrameTest); - CPPUNIT_TEST (createReferenceFrameTest); - CPPUNIT_TEST_SUITE_END (); - - public: - void setUp(void) { }; - void tearDown(void) { }; - - protected: - void createReferenceFrameTest(); - void getFrameTest(); - void asStringTest(); - void equalityTest(); - void inequalityTest(); - void greaterThanTest(); - void lessThanTest(); - void greaterThanOrEqualToTest(); - void lesserThanOrEqualToTest(); - void setReferenceFrameTest(); - - }; -} -#endif diff --git a/ext/tests/ReferenceFrame/xReferenceFrameM.cpp b/ext/tests/ReferenceFrame/xReferenceFrameM.cpp deleted file mode 100644 index 6e37c7e69..000000000 --- a/ext/tests/ReferenceFrame/xReferenceFrameM.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 3.0 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// -// Copyright 2004, The University of Texas at Austin -// -//============================================================================ - -//============================================================================ -// -//This software developed by Applied Research Laboratories at the University of -//Texas at Austin, under contract to an agency or agencies within the U.S. -//Department of Defense. The U.S. Government retains all rights to use, -//duplicate, distribute, disclose, or release this software. -// -//Pursuant to DoD Directive 523024 -// -// DISTRIBUTION STATEMENT A: This software has been approved for public -// release, distribution is unlimited. -// -//============================================================================= - -#include -#include -#include -#include -#include - -int main (int argc, char* argv[]) -{ - - // informs test-listener about testresults - CPPUNIT_NS :: TestResult testresult; - - // register listener for collecting the test-results - CPPUNIT_NS :: TestResultCollector collectedresults; - testresult.addListener (&collectedresults); - - // insert test-suite at test-runner by registry - CPPUNIT_NS :: TestRunner testrunner; - testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ()); - testrunner.run (testresult); - - // output results in compiler-format - CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr); - compileroutputter.write (); - - // return 0 if tests were successful - return collectedresults.wasSuccessful () ? 0 : 1; -} diff --git a/swig/.gitignore b/swig/.gitignore index fccc4b1ed..0d20b6487 100755 --- a/swig/.gitignore +++ b/swig/.gitignore @@ -1,3 +1 @@ *.pyc -*.new - diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt old mode 100755 new mode 100644 index 9d26ad639..ccfcc6cbe --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -1,117 +1,12 @@ #---------------------------------------- -# CMake Input: $GPSTK/swig/CMakeLists.txt +# gpstk/swig/CMakeLists.txt #---------------------------------------- cmake_minimum_required( VERSION 2.8.4 ) -message( STATUS "Inside gpstk/swig/CMakeLists.txt, PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) - -# The CMake command-line tool displays STATUS messages -# on stdout and all other message types on stderr. -# set( CMAKE_PREFIX_PATH "" ) -# list( APPEND CMAKE_PREFIX_PATH /opt/python/2.7.6 ) -# message( STATUS "DEBUG: SWIG: CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}" ) - -#------------------------------------------------------------ -# Find python executable -#------------------------------------------------------------ - -# If user does not pass in the full-path to the python executable, -# then figure it out by running python. -if( NOT PYTHON_EXECUTABLE ) - message( WARNING "PYTHON_EXECUTABLE is undefined. Will attempt find a python instance. Next time, pass in a full path to cmake using, e.g., cmake -DPYTHON_EXECUTABLE=/usr/bin/python2.7" ) - execute_process( COMMAND python -c - "import sys; print sys.executable" - OUTPUT_VARIABLE PYTHON_EXECUTABLE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) -endif() - -# If PYTHON_EXECUTABLE is still empty, something is severely wrong, -# perhaps python is not installed on this system? -if( NOT PYTHON_EXECUTABLE ) - message( FATAL_ERROR "PYTHON_EXECUTABLE: Unable to determine or use PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) - message( FATAL_ERROR "PYTHON_EXECUTABLE: Exitting now!" ) - return() -endif() - -#------------------------------------------------------------ -# Get python version number -#------------------------------------------------------------ - -# Now figure out the version of the python executable -# so we can go look for a matching python library to link against. -execute_process( COMMAND ${PYTHON_EXECUTABLE} -c - "import sys; print sys.version.split()[0]" - OUTPUT_VARIABLE PYTHON_version_output - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - -# Set the version number and then test the value to make sure it's not empty -set( PYTHON_VERSION ${PYTHON_version_output} CACHE STRING "Python version" ) -if( NOT PYTHON_VERSION STREQUAL "" ) - set( PYTHON_FOUND 1 ) - set( PYTHON ${PYTHON_EXECUTABLE} ) -else() - message( FATAL_ERROR "Cannot determine version number for PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) - return() -endif() - -# Test the version number to make sure it's above the minimum needed -if( PYTHON_VERSION VERSION_LESS 2.7 ) - set( PYTHON_FOUND 0 ) - set( PYTHON 0 ) - set( PYTHONLIBS_FOUND 0 ) - message( FATAL_ERROR "Python version [ ${PYTHON_VERSION} ] is >= the required 2.7, which is needed because argparse is used in the gpstk python module. Exit now!" ) - return() -endif() - -#------------------------------------------------------------ -# Find matching version of python library -#------------------------------------------------------------ - -find_package( PythonLibs ${PYTHON_VERSION} REQUIRED ) - -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: SWIG: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) - message( STATUS "DEBUG: SWIG: PYTHON_FOUND = ${PYTHON_FOUND}" ) - message( STATUS "DEBUG: SWIG: PYTHONLIBS_FOUND = ${PYTHONLIBS_FOUND}" ) - message( STATUS "DEBUG: SWIG: PYTHON = ${PYTHON}" ) - message( STATUS "DEBUG: SWIG: PYTHON_VERSION = ${PYTHON_VERSION}" ) - message( STATUS "DEBUG: SWIG: PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}" ) - message( STATUS "DEBUG: SWIG: PYTHON_LIBRARY = ${PYTHON_LIBRARY}" ) - message( STATUS "DEBUG: SWIG: PYTHON_INCLUDE_DIR = ${PYTHON_INCLUDE_DIR}" ) -endif() - -if( NOT PYTHONLIBS_FOUND ) - message( STATUS "Cannot find requested version of PYTHONLIBS on your system." ) - message( STATUS "Cannot build swig bindings without the right python libraries." ) - message( STATUS "PYTHON_LIBRARY and PYTHON_INCLUDE_DIR versions must match PYTHON_EXECUTABLE." ) - message( STATUS "DEBUG: SWIG: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) - message( STATUS "DEBUG: SWIG: PYTHON_FOUND = ${PYTHON_FOUND}" ) - message( STATUS "DEBUG: SWIG: PYTHONLIBS_FOUND = ${PYTHONLIBS_FOUND}" ) - message( STATUS "DEBUG: SWIG: PYTHON = ${PYTHON}" ) - message( STATUS "DEBUG: SWIG: PYTHON_VERSION = ${PYTHON_VERSION}" ) - message( STATUS "DEBUG: SWIG: PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}" ) - message( STATUS "DEBUG: SWIG: PYTHON_LIBRARY = ${PYTHON_LIBRARY}" ) - message( STATUS "DEBUG: SWIG: PYTHON_INCLUDE_DIR = ${PYTHON_INCLUDE_DIR}" ) - message( FATAL_ERROR "Cannot find PYTHONLIBS. Cannot proceed. Exiting now!" ) - return() -else() - message( STATUS "PYTHONLIBS Version requested was found. Yay for you!" ) -endif() - -#------------------------------------------------------------ -# Python Library includes -#------------------------------------------------------------ - -include_directories( ${PYTHON_INCLUDE_PATH} ) +include_directories( ${PYTHON_INCLUDE_DIRS} ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) -#------------------------------------------------------------ -# Find system SWIG package -#------------------------------------------------------------ - find_package( SWIG ) if( NOT SWIG_FOUND ) @@ -126,11 +21,6 @@ endif() include( ${SWIG_USE_FILE} ) -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: SWIG: SWIG_EXECUTABLE = ${SWIG_EXECUTABLE}" ) - message( STATUS "DEBUG: SWIG: SWIG_USE_FILE = ${SWIG_USE_FILE}" ) -endif() - #---------------------------------------- # Compiler warning disables #---------------------------------------- @@ -143,36 +33,26 @@ endif() set( CMAKE_SWIG_FLAGS "-w362,383,384,389,503" ) -#---------------------------------------- -# Compiler CXX flags -#---------------------------------------- - set( CMAKE_CXX_FLAGS "-std=c++11" ) set_source_files_properties( gpstk.i PROPERTIES CPLUSPLUS ON ) # why not also set properties for all other files.i ?!?! - -#---------------------------------------- -# Debug -#---------------------------------------- -# The CMake command-line tool, message( STATUS ) displays -# messages on stdout and all other message types on stderr. +if( NOT PYTHON_INSTALL_PREFIX ) + message( STATUS "PYTHON_INSTALL_PREFIX: Install prefix for python package was not set by user." ) + set( PYTHON_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ) + message( STATUS "PYTHON_INSTALL_PREFIX: Using CMAKE_INSTALL_PREFIX as the default, so that PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) +endif() if( DEBUG_SWITCH ) - message( STATUS "DEBUG: SWIG: DEBUG: Before swig module is set -----------------------------------------" ) - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}" ) # e.g., $HOME/git/gpstk/swig - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_LIST_FILE = ${CMAKE_CURRENT_LIST_FILE}" ) # e.g., $HOME/git/gpstk/swig/CMakeLists.txt - message( STATUS "DEBUG: SWIG: CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk/swig - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build/swig - - message( STATUS "DEBUG: SWIG: PROJECT_NAME = ${PROJECT_NAME}" ) # e.g., gpstk - message( STATUS "DEBUG: SWIG: PROJECT_BINARY_DIR = ${PROJECT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build - message( STATUS "DEBUG: SWIG: PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk - - message( STATUS "DEBUG: SWIG: CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) # e.g., $HOME/.local/gpstk - message( STATUS "DEBUG: SWIG: PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) # e.g., $HOME/.local - message( STATUS "DEBUG: SWIG: CMAKE_INSTALL_DIR = ${CMAKE_INSTALL_DIR}" ) # e.g., [empty] + message( STATUS "SWIG_EXECUTABLE = ${SWIG_EXECUTABLE}" ) + message( STATUS "SWIG_USE_FILE = ${SWIG_USE_FILE}" ) + message( STATUS "CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}" ) # e.g., $HOME/git/gpstk/swig + message( STATUS "CMAKE_CURRENT_LIST_FILE = ${CMAKE_CURRENT_LIST_FILE}" ) # e.g., $HOME/git/gpstk/swig/CMakeLists.txt + message( STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk + message( STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" ) # e.g., $HOME/git/gpstk/swig + message( STATUS "CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}" ) # e.g., $HOME/git/gpstk/build/swig + message( STATUS "PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) # e.g., $HOME/.local + message( STATUS "SWIG_DOC_DIR = ${SWIG_DOC_DIR}") endif() #---------------------------------------- @@ -188,7 +68,6 @@ endif() # make sure the swig build target outputs files to the build file tree # set( CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/install_package/${SWIG_MODULE} ) - set( SWIG_MODULE "gpstk" ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src ) @@ -197,28 +76,10 @@ swig_add_module( ${SWIG_MODULE} python gpstk.i ) # why not also list all the oth swig_link_libraries( ${SWIG_MODULE} gpstk ) swig_link_libraries( ${SWIG_MODULE} ${PYTHON_LIBRARIES} ) -#---------------------------------------- -# Copy python extension module output into package build tree -#---------------------------------------- - # Install the gpstk module into the package file tree set( INSTALL_PACKAGE_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/install_package ) set( INSTALL_PACKAGE_PATH ${CMAKE_CURRENT_BINARY_DIR}/install_package ) -if( DEBUG_SWITCH ) - message( STATUS "DEBUG: SWIG: DEBUG: After swig module is set -----------------------------------------" ) - message( STATUS "DEBUG: SWIG: EXECUTABLE_OUTPUT_PATH = ${EXECUTABLE_OUTPUT_PATH}" ) - message( STATUS "DEBUG: SWIG: WORKING_DIRECTORY = ${WORKING_DIRECTORY}" ) - message( STATUS "DEBUG: SWIG: CMAKE_SOURCE_DIR = ${CMAKE_CURRENT_DIR}" ) - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}" ) - message( STATUS "DEBUG: SWIG: CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}" ) - message( STATUS "DEBUG: SWIG: CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}" ) - message( STATUS "DEBUG: SWIG: PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) # e.g., $HOME/.local - message( STATUS "DEBUG: SWIG: CMAKE_SWIG_OUTDIR = ${CMAKE_SWIG_OUTDIR}" ) - message( STATUS "DEBUG: SWIG: INSTALL_PACKAGE_SOURCE = ${INSTALL_PACKAGE_SOURCE}" ) - message( STATUS "DEBUG: SWIG: INSTALL_PACKAGE_PATH = ${INSTALL_PACKAGE_PATH}" ) -endif() - #---------------------------------------- # Add custom commands to the _gpstk.so build target #---------------------------------------- @@ -239,13 +100,13 @@ file( COPY ${INSTALL_PACKAGE_SOURCE}/ DESTINATION ${INSTALL_PACKAGE_PATH} PATTER # CONFIGURATION: Copy meta files.txt set( METAFILES "" ) # for a single set() command, just ";" delimiter between entries in the list -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/AUTHORS.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/COPYING.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/COPYING.LESSER.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/ChangeLog.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/INSTALL.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/NEWS.txt" ) -list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/README.txt" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/AUTHORS.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/COPYING.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/COPYING.LESSER.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/ChangeLog.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/INSTALL.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/NEWS.md" ) +list( APPEND METAFILES "${CMAKE_SOURCE_DIR}/README.md" ) file( COPY ${METAFILES} DESTINATION ${INSTALL_PACKAGE_PATH} ) #-------------------------------------------- @@ -253,37 +114,17 @@ file( COPY ${METAFILES} DESTINATION ${INSTALL_PACKAGE_PATH} ) #-------------------------------------------- set( SWIG_DOC_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc ) -file( MAKE_DIRECTORY ${SWIG_DOC_DIR} ) -file( WRITE ${SWIG_DOC_DIR}/doc.i "#dummy file. Is replaced when docs are generated for bindings." ) include_directories( ${SWIG_DOC_DIR} ) - -#---------------------------------------- -# Install package tree -#---------------------------------------- +file( MAKE_DIRECTORY ${SWIG_DOC_DIR} ) +file( WRITE ${SWIG_DOC_DIR}/doc.i "// dummy file. Is replaced when docs are generated for bindings." ) # Provide ability to use CMake variables to define some values within the setup.py script -set( PYTHON_PACKAGE_VERSION "${gpstk_VERSION_MAJOR}.${gpstk_VERSION_MINOR}" ) set( SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in" ) set( SETUP_PY "${INSTALL_PACKAGE_PATH}/setup.py" ) configure_file( ${SETUP_PY_IN} ${SETUP_PY} ) -#------------------------------------------------------------ -# Install python package -#------------------------------------------------------------ - # Note: For setup.py install options, see https://docs.python.org/2/install/ -# Note: The two words "WORKING_DIRECTORY ${INSTALL_PACKAGE_PATH}" are a key-value pair -# This sets the value of WORKING_DIRECTORY equal to ${INSTALL_PACKAGE_PATH}, i.e. -# the command being run treats ${INSTALL_PACKAGE_PATH} as the current working directory - - -if( NOT PYTHON_INSTALL_PREFIX ) - message( WARNING "PYTHON_INSTALL_PREFIX: Install prefix for python package was not set by user." ) - set( PYTHON_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ) - message( WARNING "PYTHON_INSTALL_PREFIX: Using CMAKE_INSTALL_PREFIX as the default, so that PYTHON_INSTALL_PREFIX = ${PYTHON_INSTALL_PREFIX}" ) -endif() - -install( CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install --prefix=${PYTHON_INSTALL_PREFIX} WORKING_DIRECTORY ${INSTALL_PACKAGE_PATH})" ) +install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --prefix=${PYTHON_INSTALL_PREFIX} WORKING_DIRECTORY ${INSTALL_PACKAGE_PATH})" ) #------------------------------------------------------------ # These files aren't required to use the bindings but are @@ -292,7 +133,3 @@ install( CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install --prefix=${ file( GLOB swig_includes ${CMAKE_CURRENT_SOURCE_DIR}/src/* ) install( FILES ${swig_includes} ${CMAKE_CURRENT_SOURCE_DIR}/gpstk.i DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) - -#------------------------------------------------------------ -# The End -#------------------------------------------------------------ diff --git a/swig/docstring_generator.py b/swig/docstring_generator.py index e4e3c0c4e..4393c9f40 100755 --- a/swig/docstring_generator.py +++ b/swig/docstring_generator.py @@ -1,23 +1,11 @@ #!/usr/bin/env python -"""GPSTk python-swig binding documentation generator. - -This reads every file in the $gpstk_root/doc/xml (where doxygen places its xml) -Then uses $gpstk_root/swig/doxy2swig.py to create docstring output for a SWIG .i file. -These .i files are placed in $gpstk_root/swig/doc. -Then doc.i is auto-generated to include all of these new files in the doc/ folder. - -Usage: - $ cd $gpstk_root/swig - $ python docstring_generator.py -""" - - import doxy2swig # local file import glob import os import sys import subprocess +import argparse def file_name(path): @@ -48,24 +36,26 @@ def clean_errors(file): f.write(data) f.close() -def generate_docs(): - # This present script should live in '$gpstk_root/swig', - # so to get the $gpstk_root, just strip off the file name + +def generate_docs(args): + # This present script should live in '$gpstk_root/swig', + # so to get the $gpstk_root, just strip off the file name # and use split() to pop off the 'swig' directory from the # remaining file path. script_fullpath_name = os.path.realpath(__file__) path_gpstk_swig = os.path.dirname( script_fullpath_name ) (gpstk_root, swig_dir) = os.path.split( path_gpstk_swig ) - + # Build a list of all the XML files that dOxygen output previously - xml_glob_pattern = gpstk_root + os.path.sep + 'doc' + os.path.sep + 'xml' + os.path.sep + '*.xml' + xml_glob_pattern = os.path.sep.join((args.src_dir, 'xml', '*.xml')) xml_files = glob.glob( xml_glob_pattern ) num_files = len( xml_files ) if num_files == 0: print 'WARNING: No doxygen-xml files found, docstrings cannot be generated.' + return # create directories for swig doc files - path_gpstk_swig_doc = path_gpstk_swig + os.path.sep + 'doc' + path_gpstk_swig_doc = args.dst_dir if not os.path.exists( path_gpstk_swig_doc ): os.makedirs( path_gpstk_swig_doc ) @@ -96,4 +86,23 @@ def generate_docs(): if __name__ == '__main__': - generate_docs() + parser = argparse.ArgumentParser(description=""" + GPSTk python-swig binding documentation generator. + This reads every file in the $doc_dir/xml (where doxygen places its xml) + Then uses $gpstk_root/swig/doxy2swig.py to create docstring output for a SWIG .i file. + These .i files are placed in $gpstk_root/swig/doc. + Then doc.i is auto-generated to include all of these new files in the doc/ folder. + """) + + parser.add_argument("-d", default=0, dest="debug", action="count", + help="Increase the level of debug output.") + + parser.add_argument(dest="src_dir", + help="Directory where the doxygen xml files are.") + + parser.add_argument(dest="dst_dir", + help="Directory to write swig.i files to.") + + args = parser.parse_args() + + generate_docs(args) diff --git a/swig/gpstk.i b/swig/gpstk.i old mode 100755 new mode 100644 diff --git a/swig/setup.py.in b/swig/setup.py.in old mode 100755 new mode 100644 index 674d84a50..1f8fcf08b --- a/swig/setup.py.in +++ b/swig/setup.py.in @@ -66,13 +66,13 @@ requirements_list = [ "python >= 2.7.3", #---------------------------------------- setup( name = "gpstk", - version = "@PYTHON_PACKAGE_VERSION@", + version = "@GPSTK_VERSION@", author = "Space and Geophysics Lab, ARL, University of Texas at Austin", author_email = "gpstk@arlut.utexas.edu", url = "http://www.gpstk.org/", license = "LICENSE.txt", description = "GPSTk python package installer", - long_description = open('README.txt').read(), + long_description = open('README.md').read(), keywords = ('GNSS', 'GPS', 'RINEX'), classifiers = classifiers_list, packages = ['gpstk', 'gpstk.test', 'gpstk.data'], diff --git a/swig/sphinx/Makefile b/swig/sphinx/Makefile old mode 100755 new mode 100644 diff --git a/swig/sphinx/build.rst b/swig/sphinx/build.rst old mode 100755 new mode 100644 diff --git a/swig/sphinx/devdocs.rst b/swig/sphinx/devdocs.rst old mode 100755 new mode 100644 diff --git a/swig/sphinx/examples.rst b/swig/sphinx/examples.rst old mode 100755 new mode 100644 diff --git a/swig/sphinx/index.rst b/swig/sphinx/index.rst old mode 100755 new mode 100644 diff --git a/swig/sphinx/intro.rst b/swig/sphinx/intro.rst old mode 100755 new mode 100644 diff --git a/swig/sphinx/newstuff.rst b/swig/sphinx/newstuff.rst old mode 100755 new mode 100644 diff --git a/test-report.sh b/test-report.sh new file mode 100755 index 000000000..12b5ca54f --- /dev/null +++ b/test-report.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +source $(dirname "$BASH_SOURCE")/build_setup.sh + + +#---------------------------------------- +# capture the test output +#---------------------------------------- + +ctest_keyword=GpstkTest +ctest_log_raw=$build_root/Testing/Temporary/LastTest.log +ctest_log_save=$build_root/test.log +cat $ctest_log_raw | grep "$ctest_keyword" > $ctest_log_save + +#---------------------------------------- +# summary results +#---------------------------------------- + +test_count=$(cat $ctest_log_save | wc -l) +tests_passed=$(cat $ctest_log_save | grep "failBit=0" | wc -l) +tests_failed=$(cat $ctest_log_save | grep "failBit=1" | wc -l) + +echo "" +echo "Build: $build_root" +echo "" +echo "Tests: Summary Results" +echo "------------------------------------------------------------" +echo "Number of tests run = $test_count" +echo "Number of tests passed = $tests_passed" +echo "Number of tests failed = $tests_failed" +echo "------------------------------------------------------------" +echo "" + +#---------------------------------------- +# Search test.log for keywords, summarize +#---------------------------------------- + +keyword_list=() +keyword_list+=("AlmOrbit") +keyword_list+=("ANSITime") +keyword_list+=("Binex_Attrs") +keyword_list+=("Binex_ReadWrite") +keyword_list+=("Binex_Types") +keyword_list+=("Binex_UpdateExtract") +keyword_list+=("BinUtils") +keyword_list+=("BivarStats") +keyword_list+=("CivilTime") +keyword_list+=("ClockModel") +keyword_list+=("CommonTime") +keyword_list+=("Convhelp") +keyword_list+=("FileFilter") +keyword_list+=("FileHunter") +keyword_list+=("FileSpec") +keyword_list+=("FileStore") +keyword_list+=("FileUtils") +keyword_list+=("GPSWeekSecond") +keyword_list+=("GPSWeekZcount") +keyword_list+=("GPSZcount") +keyword_list+=("HelmertTransform") +keyword_list+=("IonoModel") +keyword_list+=("JulianDate") +keyword_list+=("Matrix") +keyword_list+=("MJD") +keyword_list+=("ObsID") +keyword_list+=("PolyFit") +keyword_list+=("Position") +keyword_list+=("RACRotation") +keyword_list+=("ReferenceFrame") +keyword_list+=("RinexEph") +keyword_list+=("RinexMet") +keyword_list+=("RinexNav") +keyword_list+=("RinexObs") +keyword_list+=("Rinex_T") +keyword_list+=("SatID") +keyword_list+=("Sinex_ReadWrite") +keyword_list+=("SP3Eph") +keyword_list+=("SP3SatID") +keyword_list+=("Stats") +keyword_list+=("Stl_helpers") +keyword_list+=("StringUtils") +keyword_list+=("SystemTime") +keyword_list+=("TimeConverters") +keyword_list+=("TimeRange") +keyword_list+=("TimeString") +keyword_list+=("TimeSystem") +keyword_list+=("TimeTag") +keyword_list+=("Triple") +keyword_list+=("UnixTime") +keyword_list+=("ValidType") +keyword_list+=("Vector") +keyword_list+=("WxObsMap") +keyword_list+=("Xvt") +keyword_list+=("YDSTime") + + +myheader="%-16s, %4s, %4s, %4s, %5s\n" +myformat="%-16s, %4d, %4d, %4d, %5.1f \n" +mydivider="=========================================" + + +# myformat="name = %-16s, tests run = %4d, passed = %4d, failed = %4d, %%passed = %5.1f \n" + +echo "------------------------------------------------------------" +echo "Tests: Results by Category" +echo "------------------------------------------------------------" + +echo "" +printf "$myheader" "NAME" "RUN" "PASS" "FAIL" "%PASS" +printf "%s\n" "$mydivider" + +for keyword in "${keyword_list[@]}"; do + + tests_run=$(cat $ctest_log_save | grep -i "$keyword" | wc -l) + tests_passed=$(cat $ctest_log_save | grep -i "$keyword" | grep "failBit=0" | wc -l) + tests_failed=$(cat $ctest_log_save | grep -i "$keyword" | grep "failBit=1" | wc -l) + percent_pass=$(awk -v r=$tests_run -v p=$tests_passed 'BEGIN { print (100*(p/r)) }') + + printf "$myformat" "$keyword" "$tests_run" "$tests_passed" "$tests_failed" "$percent_pass" + +done + +echo "" +echo "------------------------------------------------------------" +echo "" + diff --git a/user.ctest b/user.ctest new file mode 100644 index 000000000..2148adf8b --- /dev/null +++ b/user.ctest @@ -0,0 +1,70 @@ +# This is a CTest script for a user build. It is meant to be called like so: +# ctest -S -V +# +# It uses the current dir as the root of the repo to test +# and uses the build-hostname-branch as the build dir +# + +# Find the name of the git branch +execute_process( + COMMAND git branch --no-color + COMMAND sed -ne "s/^* \\(.*\\)/\\1/p" + OUTPUT_VARIABLE branch OUTPUT_STRIP_TRAILING_WHITESPACE ) + +# The $ENV{HOSTNAME} var doesn't seem to work. Hmm. +if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + execute_process( + COMMAND hostname + OUTPUT_VARIABLE uname -n OUTPUT_STRIP_TRAILING_WHITESPACE ) +else() + execute_process( + COMMAND hostname + OUTPUT_VARIABLE hostname OUTPUT_STRIP_TRAILING_WHITESPACE ) +endif() + +# Figure out how many cores to use +if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + execute_process( + COMMAND kstat cpu_info + COMMAND grep instance + COMMAND wc -l + OUTPUT_VARIABLE num_cores ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" ) + execute_process( + COMMAND sysctl -n hw.ncpu + OUTPUT_VARIABLE num_cores ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" ) + execute_process( + COMMAND nproc + OUTPUT_VARIABLE num_cores) + math(EXPR num_cores "${num_cores} + 1" ) +elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Windows" ) + set( num_cores 1 ) +else() + message( ERROR "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}, not supported. Currently supported: Linux, Darwin, SunOS, Windows" ) +endif() + +math(EXPR num_threads "${num_cores}/2") + +set( CTEST_BUILD_FLAGS -j${num_threads} ) +set( CTEST_SOURCE_DIRECTORY "$ENV{PWD}" ) +set( CTEST_BUILD_NAME "${hostname}-${branch}" ) +set( CTEST_BINARY_DIRECTORY "$ENV{PWD}/build-${CTEST_BUILD_NAME}" ) +set( CTEST_SITE "${BUILD_NAME}" ) +set( CTEST_CMAKE_GENERATOR "Unix Makefiles" ) +set( CTEST_CONFIGURATION_TYPE "Experimental" ) +set( DEBUG_VALUE "false" ) + +find_program( CTEST_GIT_COMMAND NAMES git ) +find_program( CTEST_CMAKE_COMMAND NAMES cmake ) + +set( CTEST_CMAKE_COMMAND "${CTEST_CMAKE_COMMAND} -Wno-dev " + "-DDEBUG_SWITCH=${DEBUG_VALUE} -DTEST_SWITCH=ON -DBUILD_EXT=ON" ) +set( CTEST_CONFIGURE_COMMAND "${CTEST_CMAKE_COMMAND} \"-G${CTEST_CMAKE_GENERATOR}\"" ) +set( CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} ${CTEST_SOURCE_DIRECTORY}" ) + +ctest_start ( "Experimental" ) +ctest_configure() +ctest_build() +ctest_test() +