Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pavlis patch 7 #412

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cxx/src/lib/io/fileio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ std::vector<long int> fwrite_to_file(mspass::seismic::LoggingEnsemble<mspass::se
try{
FILE *fp;
vector<long int> foffs;
/* This will return an empty vector if the ensemble is marked dead - callers should handle this condition
but they normally shouldn't be calling this function if the entire ensemble is marked dead anyway.*/
if(d.dead()) return(foffs);
string fname;
if(dir.length()>0)
/* for expected context for use in python we will assume dir does not
Expand All @@ -101,6 +104,8 @@ std::vector<long int> fwrite_to_file(mspass::seismic::LoggingEnsemble<mspass::se
/* use the name of the overloaded parent instead of the actual function - intentional*/
throw MsPASSError("fwrite_to_file: Open failed on file "+fname,ErrorSeverity::Invalid);
for (int i = 0; i < d.member.size(); ++i) {
/* Silenetly skip dead data */
if(d.member[i].dead()) continue;
long int foff = ftell(fp);
foffs.push_back(foff);
TimeSeries& t = d.member[i];
Expand All @@ -126,6 +131,7 @@ std::vector<long int> fwrite_to_file(mspass::seismic::LoggingEnsemble<mspass::se
try{
FILE *fp;
vector<long int> foffs;
if(d.dead()) return(foffs);
string fname;
if(dir.length()>0)
/* for expected context for use in python we will assume dir does not
Expand All @@ -138,6 +144,8 @@ std::vector<long int> fwrite_to_file(mspass::seismic::LoggingEnsemble<mspass::se
/* use the name of the overloaded parent instead of the actual function - intentional*/
throw MsPASSError("fwrite_to_file: Open failed on file "+fname,ErrorSeverity::Invalid);
for (int i = 0; i < d.member.size(); ++i) {
/* Silently skip dead data */
if(d.member[i].dead()) continue;
long int foff = ftell(fp);
foffs.push_back(foff);
Seismogram& t = d.member[i];
Expand Down