Skip to content

Commit

Permalink
Merge pull request #137 from geodynamics/developer
Browse files Browse the repository at this point in the history
Merge from developer
  • Loading branch information
andersp committed Sep 14, 2022
2 parents 3182f60 + ea18818 commit 9f1619b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/TimeSeries.C
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ void TimeSeries::writeFile( string suffix )
// Open the output HDF5 file if not already opened
std::string h5fname, fidName;
hid_t fid, grp = 0;
double stlalodp[3], stxyz[3];
double stlalodp[3], stxyz[3], dist;
float origintime, windows[4];
int myRank;
MPI_Comm_rank(m_ew->m_1d_communicator, &myRank);
Expand Down Expand Up @@ -651,6 +651,21 @@ void TimeSeries::writeFile( string suffix )
origintime = float(m_epi_time_offset);
openWriteAttr(fid, "ORIGINTIME", H5T_NATIVE_FLOAT, &origintime);

// Actual location in SW4
stlalodp[0] = double(m_rec_gp_lat);
stlalodp[1] = double(m_rec_gp_lon);
stlalodp[2] = double(m_sta_z);
openWriteAttr(grp, "ACTUALSTLA,STLO,STDP", H5T_NATIVE_DOUBLE, stlalodp);

// Distance
dist = sqrt( (mX-mGPX)*(mX-mGPX)+(mY-mGPY)*(mY-mGPY) );
openWriteAttr(grp, "DISTFROMACTUAL", H5T_NATIVE_DOUBLE, &dist);

stxyz[0] = double(mGPX);
stxyz[1] = double(mGPY);
stxyz[2] = double(mGPZ);
openWriteAttr(grp, "ACTUALSTX,STY,STZ", H5T_NATIVE_DOUBLE, stxyz);

m_isMetaWritten = true;
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/sachdf5.C
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ int createTimeSeriesHDF5File(vector<TimeSeries*> & TimeSeries, int totalSteps, f
// Lon, lat, dep
createAttr(grp, "STLA,STLO,STDP", H5T_NATIVE_DOUBLE, attr_space3);

// Actual location in SW4
createAttr(grp, "ACTUALSTLA,STLO,STDP", H5T_NATIVE_DOUBLE, attr_space3);

// Distance
createAttr(grp, "DISTFROMACTUAL", H5T_NATIVE_DOUBLE, attr_space1);

// Actual xyz location in SW4
createAttr(grp, "ACTUALSTX,STY,STZ", H5T_NATIVE_DOUBLE, attr_space3);

// TODO: Location, no value to write now
createAttr(grp, "LOC", H5T_NATIVE_INT, attr_space1);

Expand Down

0 comments on commit 9f1619b

Please sign in to comment.