Skip to content

Commit

Permalink
Merge pull request #176 from icsm-au/1.2.4
Browse files Browse the repository at this point in the history
Version 1.2.4 (WGS 84 support)
  • Loading branch information
rogerfraser committed Mar 9, 2022
2 parents d010f7d + a6e2cca commit 7443f0a
Show file tree
Hide file tree
Showing 30 changed files with 1,657 additions and 241 deletions.
2 changes: 1 addition & 1 deletion dynadjust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.0)

project (dynadjust)

set (DYNADJUST_VERSION "1.2.2")
set (DYNADJUST_VERSION "1.2.4")

if (BUILD_TESTING)
enable_testing()
Expand Down
3 changes: 3 additions & 0 deletions dynadjust/dynadjust/dnaadjust/dnaadjust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13942,6 +13942,9 @@ void dna_adjust::SetDefaultReferenceFrame()
// * If dnareftran has been run, every station and measurement record will
// have been transformed to the one frame and epoch. These reference frame
// records will be consistent with the bst/bms_meta.
// * If the user has not specified an epoch with WGS84, then the epoch will
// be set to "time immemorial" being 01.01.1900. Any occurrence of this will
// cause output to be set to an empty string ("").
try {
// Load binary stations data. Throws runtime_error on failure.
dna_io_bst bst;
Expand Down
55 changes: 42 additions & 13 deletions dynadjust/dynadjust/dnaimport/dnainterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ void dna_import::UpdateEpoch(const vifm_t* vinput_file_meta)
// Do nothing
return;

if (dateFromString<date>(epoch) == timeImmemorial<date>())
epoch = "";

m_strProjectDefaultEpoch = epoch;

// Set default epoch
Expand Down Expand Up @@ -223,6 +226,9 @@ void dna_import::InitialiseDatum(const string& reference_frame)
m_strProjectDefaultEpsg = datum_.GetEpsgCode_s();
m_strProjectDefaultEpoch = datum_.GetEpoch_s();

if (datum_.GetEpoch() == timeImmemorial<date>())
m_strProjectDefaultEpoch = "";

// Update binary file meta
// Note: the following rule applies each time a new file is loaded:
// * This method (InitialiseDatum) is called (from dnaimportwrapper) before any files are loaded
Expand Down Expand Up @@ -1196,7 +1202,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
import_file_mutex.unlock();
}
catch (const runtime_error& e) {
SignalExceptionParse(static_cast<string>(e.what()), 0);
throw XMLInteropException(e.what(), 0);
}

// Station file
Expand All @@ -1221,14 +1227,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
}
stringstream ss;
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read stations file " << fileName << "." << endl << " " << f.what();
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
catch (const XMLInteropException& f) {
stringstream ss;
ss << " - line " << m_lineNo;
ss << ", column " << m_columnNo << endl;
ss << " - " << f.what();
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
catch (...) {
if (ifsInputFILE_->eof())
Expand All @@ -1239,7 +1245,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
}
stringstream ss;
ss << "ParseDNA(): An error was encountered when attempting to read stations file " << fileName << ".";
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
}
else if (idt == msr_data ||
Expand All @@ -1263,14 +1269,14 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
}
stringstream ss;
ss << "ParseDNA(): An ios_base failure was encountered when attempting to read measurements file " << fileName << "." << endl << " " << f.what();
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
catch (const XMLInteropException& f) {
stringstream ss;
ss << endl << " - line " << m_lineNo;
ss << ", column " << m_columnNo << endl;
ss << " - " << f.what();
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
catch (...) {
if (ifsInputFILE_->eof())
Expand All @@ -1283,7 +1289,7 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32
ss << "ParseDNA(): An error was encountered when attempting to read measurements file " << fileName << "." << endl;
ss << " - line " << m_lineNo;
ss << ", column " << m_columnNo << endl;
SignalExceptionParse(ss.str(), 0);
throw XMLInteropException(ss.str(), 0);
}
}
}
Expand Down Expand Up @@ -1312,7 +1318,6 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, string* su

try {
getline((*ifsInputFILE_), sBuf);
stn_ptr.reset(new CDnaStation(datum_.GetName(), datum_.GetEpoch_s()));
}
catch (...) {
if (ifsInputFILE_->eof())
Expand Down Expand Up @@ -1342,6 +1347,9 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, string* su
if (sBuf.compare(0, 1, "*") == 0)
continue;

// initialise new station
stn_ptr.reset(new CDnaStation(datum_.GetName(), datum_.GetEpoch_s()));

stn_ptr->SetfileOrder(g_fileOrder++);

// name
Expand Down Expand Up @@ -1953,7 +1961,17 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool
// Get the epoch from the file
tmp = ParseEpochValue(sBuf, "ParseDNAMSRGPSBaselines");

if (!tmp.empty())
if (tmp.empty())
{
if (isEpsgWGS84Ensemble(epsgCodeFromName<UINT32, string>(msr_ptr->GetReferenceFrame())))
{
// Set the cluster epoch
msr_ptr->SetEpoch("");
// Set the baseline epoch
bslTmp.SetEpoch("");
}
}
else
{
// Set the cluster epoch
msr_ptr->SetEpoch(tmp);
Expand Down Expand Up @@ -2176,7 +2194,17 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign
// Get the epoch from the file
tmp = ParseEpochValue(sBuf, "ParseDNAMSRGPSPoints");

if (!tmp.empty())
if (tmp.empty())
{
if (isEpsgWGS84Ensemble(epsgCodeFromName<UINT32, string>(msr_ptr->GetReferenceFrame())))
{
// Set the cluster epoch
msr_ptr->SetEpoch("");
// Set the baseline epoch
pntTmp.SetEpoch("");
}
}
else
{
// Set the cluster epoch
msr_ptr->SetEpoch(tmp);
Expand Down Expand Up @@ -2389,6 +2417,7 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f
{
string parsed_value, tmp;
double d;
UINT32 u;

// degrees value
try {
Expand All @@ -2402,10 +2431,10 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f
// minutes value
try {
tmp = trimstr(sBuf.substr(dml_.msr_ang_m, dmw_.msr_ang_m));
d = DoubleFromString<double>(tmp);
if (d < 10 && tmp.at(0) != '0')
u = LongFromString<UINT32>(tmp);
if (u < 10)
parsed_value.append("0");
parsed_value.append(tmp);
parsed_value.append(StringFromT<UINT32>(u));
}
catch (...) {
SignalExceptionParseDNA(calling_function + "(): Could not extract minutes value from the record: ",
Expand Down
35 changes: 28 additions & 7 deletions dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
//
UINT32 stnCount(0), msrCount(0), clusterID(0);

// obtain the project reference frame
string epsgCode(epsgStringFromName<string>(p.i.reference_frame));

size_t pos = string::npos;
size_t strlen_arg = 0;
for_each(p.i.input_files.begin(), p.i.input_files.end(),
Expand Down Expand Up @@ -857,7 +860,6 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*

// Produce a warning if the input file's default reference frame
// is different to the project reference frame
string epsgCode(epsgStringFromName<string>(p.i.reference_frame));
string inputFileEpsg;
try {
inputFileEpsg = datumFromEpsgString<string>(input_file_meta.epsgCode);
Expand All @@ -870,7 +872,6 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr*
{
stringstream ssEpsgWarning;


ssEpsgWarning << "- Warning: Input file reference frame (" << inputFileEpsg <<
") does not match the " << endl << " default reference frame.";
if (!p.g.quiet)
Expand Down Expand Up @@ -1288,6 +1289,14 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}

// obtain the project reference frame
UINT32 epsgCode(epsgCodeFromName<UINT32>(p.i.reference_frame));

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// start "total" time
cpu_timer time;


// Import discontinuity file and apply discontinuities
// Due to the structure and format of SINEX files, it is essential that
// discontinuities be parsed prior to reading any SINEX files.
Expand Down Expand Up @@ -1337,10 +1346,6 @@ int main(int argc, char* argv[])
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// start "total" time
cpu_timer time;

// Import network information based on a segmentation block?
if (p.i.import_block)
{
Expand Down Expand Up @@ -2376,7 +2381,23 @@ int main(int argc, char* argv[])
{
cout << "- Warning: some files were not parsed - please read the log file for more details." << endl;
imp_file << "- Warning: some files were not parsed - please read the log file for more details." << endl;
}
}

// Produce a warning if an ensemble is set as the default reference frame
if (isEpsgWGS84Ensemble(epsgCode))
{
stringstream ssEnsembleWarning;
ssEnsembleWarning << endl <<
"- Warning: The '" << p.i.reference_frame << "' reference frame set for this project refers to the" << endl <<
" \"World Geodetic System 1984 (WGS 84) ensemble\". The WGS 84 ensemble is" << endl <<
" only suitable for low accuracy (metre level) positioning and does not" << endl <<
" provide for precise transformations to other well-known reference frames." << endl <<
" To achieve reliable adjustment results from data on WGS 84, please refer" << endl <<
" to \"Configuring import options\" in the DynAdjust User's Guide." << endl;
if (!p.g.quiet)
cout << ssEnsembleWarning.str();
imp_file << ssEnsembleWarning.str();
}

milliseconds elapsed_time(milliseconds(time.elapsed().wall/MILLI_TO_NANO));
string time_message = formatedElapsedTime<string>(&elapsed_time, "+ Total file handling process took ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>-n ps2 vic2ex.simult.adj.stn pseudo-driver-file-2.msr --simulate --geo geoidef.geo --export-dna</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(DIST)_git_issues\print-ignored-msrs</LocalDebuggerWorkingDirectory>
<LocalDebuggerCommandArguments>-n 09139test 09139.stn 09139.msr --export-dna -r "WGS84 (G730)"</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(DIST)_git_issues\wgs84</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand Down
1 change: 1 addition & 0 deletions dynadjust/dynadjust/dnaplot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ add_library (${PROJECT_NAME} SHARED
${CMAKE_SOURCE_DIR}/include/parameters/dnaellipsoid.cpp
${CMAKE_SOURCE_DIR}/include/parameters/dnaprojection.cpp
${CMAKE_SOURCE_DIR}/include/functions/dnastringfuncs.cpp
${CMAKE_SOURCE_DIR}/include/functions/dnaprocessfuncs.cpp
${CMAKE_SOURCE_DIR}/include/math/dnamatrix_contiguous.cpp
${CMAKE_SOURCE_DIR}/include/measurement_types/dnamsrtally.cpp
${CMAKE_SOURCE_DIR}/include/measurement_types/dnastation.cpp
Expand Down

0 comments on commit 7443f0a

Please sign in to comment.