Skip to content

Commit

Permalink
Merge pull request #128 from kwschultz/master
Browse files Browse the repository at this point in the history
Preparing for next Release, version 2.1.0
  • Loading branch information
kwschultz committed Dec 8, 2015
2 parents 653619d + 74b9fd1 commit 60cbeeb
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/quakelib/cmake/)

# Set the version number
SET(VQ_VERSION_MAJOR 2)
SET(VQ_VERSION_MINOR 0)
SET(VQ_VERSION_MINOR 1)
SET(VQ_VERSION_SUBMINOR 0)
SET(VQ_VERSION_STR "${VQ_VERSION_MAJOR}.${VQ_VERSION_MINOR}.${VQ_VERSION_SUBMINOR}")

Expand Down
18 changes: 9 additions & 9 deletions PyVQ/pyvq/pyvq.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ def trace_plot(self, model_file):
model_file = model_file.split("/")[-1]
return "traces_"+model_file.split(".")[0]+".png"

def element_plot(self, model_file,type):
def distribution_plot(self, model_file, type):
# Remove any folders in front of model_file name
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
return "block_"+type+"_hist_"+model_file.split(".")[0]+".png"
return type+"_"+model_file.split(".")[0]+".png"

def diagnostic_plot(self, event_file, plot_type, min_year=None, max_year=None, min_mag=None, combine=None):
# Add tags to convey the subsets/cuts being made
Expand Down Expand Up @@ -1874,7 +1874,7 @@ def create_plot(self, fig, color_index, plot_type, log_y, x_data, y_data, plot_t
if len(x_data) > 200: BINS=100
elif len(x_data) < 60: BINS=20
else: BINS=100
ax.hist(x_data, bins=BINS, color = STAT_COLOR_CYCLE[color_index%len(STAT_COLOR_CYCLE)], histtype='stepfilled')
ax.hist(x_data, bins=BINS, color = STAT_COLOR_CYCLE[color_index%len(STAT_COLOR_CYCLE)], histtype='stepfilled', log=log_y)
plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)
#plt.savefig(filename,dpi=100)
#sys.stdout.write("Plot saved: {}\n".format(filename))
Expand Down Expand Up @@ -2877,7 +2877,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
if args.reference:
areas = [area/args.reference for area in areas]
units = "{:.5f}".format(args.reference)+units
filename = SaveFile().element_plot(model_file, "area")
filename = SaveFile().distribution_plot(model_file, "area_hist")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "hist", False, areas, None, model_file, "element area ["+units+"]", "", filename)
Expand All @@ -2895,7 +2895,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
if args.reference:
lengths = [length/args.reference for length in lengths]
units = "{:.5f}".format(args.reference)+units
filename = SaveFile().element_plot(model_file, "fault_length_hist")
filename = SaveFile().distribution_plot(model_file, "fault_length_hist")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "hist", False, lengths, None, model_file, "fault length ["+units+"]", "", filename)
Expand All @@ -2918,7 +2918,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
for size in sorted(cum_len.iterkeys()):
lens_x.append(size)
lens_y.append(cum_len[size])
filename = SaveFile().element_plot(model_file, "fault_length_distrib")
filename = SaveFile().distribution_plot(model_file, "fault_length_distrib")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "line", True, lens_x, lens_y, model_file, "fault length L ["+units+"]", "Cumulative faults with length L or larger", filename)
Expand All @@ -2933,7 +2933,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
fig = plt.figure()
model_file = args.model_file
fractions = [geometry.model.element(elem_num).aseismic() for elem_num in range(geometry.model.num_elements())]
filename = SaveFile().element_plot(model_file, "aseismic")
filename = SaveFile().distribution_plot(model_file, "aseismic_hist")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "hist", False, fractions, None, model_file, units, "", filename)
Expand All @@ -2951,7 +2951,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
if args.reference:
lengths = [length/args.reference for length in lengths]
units = "{:.5f}".format(args.reference)+units
filename = SaveFile().element_plot(model_file, "length")
filename = SaveFile().distribution_plot(model_file, "length_hist")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "hist", False, lengths, None, model_file, "element length ["+units+"]", "", filename)
Expand All @@ -2970,7 +2970,7 @@ def leonard_2010(self, type, min_mag, max_mag, num=5):
if args.reference:
areas = [area/args.reference for area in areas]
units = "{:.5f}".format(args.reference)+units
filename = SaveFile().element_plot(model_file, "stress drop")
filename = SaveFile().distribution_plot(model_file, "stress_drop_hist")
if len(model_file.split("/")) > 1:
model_file = model_file.split("/")[-1]
BasePlotter().create_plot(fig, 0, "hist", False, drops, None, model_file, "element stress drop ["+units+"], stress drop factor = {}".format(factor), "", filename)
Expand Down
14 changes: 10 additions & 4 deletions doc/vq.tex
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

%%%%%%%%%%%%%%%%%%%%%%%%%%% Lyx Title Page
\title{Virtual Quake User Manual}
\author{Kasey W. Schultz\\Eric M. Heien\\Michael K. Sachs\\Mark R. Yoder\\John B. Rundle\\Donald L. Turcotte\\\\ \copyright University of California, Davis\\
Version 2.0.0}
\author{Kasey W. Schultz\\Eric M. Heien\\Michael K. Sachs\\Mark R. Yoder\\John M. Wilson\\John B. Rundle\\Donald L. Turcotte\\\\ \copyright University of California, Davis\\
Version 2.1.0}
%\date{\noindent \today}


Expand Down Expand Up @@ -117,7 +117,7 @@
% FILL: author list
% e.g. Author One\\Author Two\\Author Three\\
% be sure to have a newline (\\) after the final author
Kasey W. Schultz~~~Eric M. Heien~~~Michael K. Sachs\\Mark R. Yoder~~~John B. Rundle~~~Donald L. Turcotte\\
Kasey W. Schultz~~~Eric M. Heien~~~Michael K. Sachs~~~John M. Wilson\\Mark R. Yoder~~~John B. Rundle~~~Donald L. Turcotte\\
}
{\fontfamily{\sfdefault}\selectfont www.geodynamics.org}

Expand Down Expand Up @@ -207,7 +207,7 @@ \section*{Citation}

And to cite the manual:
\begin{itemize}
\item K. W. Schultz, E. M. Heien, M. K. Sachs, M. R. Yoder, J. B. Rundle, D. L. Turcotte (2015), Virtual Quake User Manual, Version 2.0.0. Davis, California, USA: Computational Infrastructure for Geodynamics. URL: \href{http://geodynamics.org/cig/software/github/vq/v2.0.0/vq_manual_2.0.0.pdf}{geodynamics.org/cig/software/github/vq/v2.0.0/vq\_manual\_2.0.0.pdf}
\item K. W. Schultz, E. M. Heien, M. K. Sachs, M. R. Yoder, J. M. Wilson, J. B. Rundle, D. L. Turcotte (2015), Virtual Quake User Manual, Version 2.1.0. Davis, California, USA: Computational Infrastructure for Geodynamics. URL: \href{http://geodynamics.org/cig/software/github/vq/v2.1.0/vq_manual_2.1.0.pdf}{geodynamics.org/cig/software/github/vq/v2.1.0/vq\_manual\_2.1.0.pdf}
\end{itemize}

The developers also request that in your oral presentations and in
Expand Down Expand Up @@ -2312,6 +2312,12 @@ \subsection{\noindent Geometry/Model Plotting Parameters}
\hline
\texttt{\small{--block\_length\_hist}} & Create and save a histogram of fault element lengths (square root of area). To present numbers relative to a reference value, must specify --reference .\tabularnewline
\hline
\texttt{\small{--block\_aseismic\_hist}} & Create and save a histogram of fault element aseismic fractions (percent of fault slip that is aseismic).\tabularnewline
\hline
\texttt{\small{--fault\_length\_hist}} & Create and save a histogram of fault lengths . To present numbers relative to a reference value, must specify --reference .\tabularnewline
\hline
\texttt{\small{--fault\_length\_distribution}} & Create and save the cumulative distribution of fault lengths.\tabularnewline
\hline
\texttt{\small{--reference}} & A reference number or unit value for \texttt{\small{--block\_length\_hist}} or \texttt{\small{--block\_area\_hist}} plots.\tabularnewline
\hline
\texttt{\small{--traces}} & Plot the fault traces on a simple map.\tabularnewline
Expand Down
14 changes: 12 additions & 2 deletions quakelib/src/QuakeLibIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,14 @@ void quakelib::ModelWorld::compute_stress_drops(const double &stress_drop_factor

eit->second.set_stress_drop(stress_drop);

//////////////////////
//std::cout << eit->second.stress_drop() << std::endl;

/////
// TEMPORARY ASEISMIC CUT OFF, anything less than 0.13 gets set to 0
/////
// if (eit->second.aseismic() <= 0.13 ) {
// eit->second.set_aseismic(0.0);
// }

}

}
Expand Down Expand Up @@ -1024,6 +1030,10 @@ void quakelib::ModelWorld::clear(void) {
_vertices.clear();
}

void quakelib::ModelWorld::clear_faults(void) {
_faults.clear();
}

int quakelib::ModelWorld::read_file_ascii(const std::string &file_name) {
std::ifstream in_file;
unsigned int i, num_sections, num_elements, num_vertices, num_faults;
Expand Down
1 change: 1 addition & 0 deletions quakelib/src/QuakeLibIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,7 @@ namespace quakelib {
const UIndex &start_vertex_index) const;
ModelRemapping remove_duplicate_vertices_remap(void) const;
void clear(void);
void clear_faults(void);

void reset_base_coord(const LatLonDepth &new_base);

Expand Down
2 changes: 0 additions & 2 deletions src/core/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Simulation::Simulation(int argc, char **argv) : SimFramework(argc, argv) {

// Check validity of parameters
// TODO: add more checks here
//assertThrow(!getVersion().compare("2.0"),
// "sim.version: Parameter file version must be 2.0");
assertThrow(getSimStart()>=0,
"sim.start_year: Start year must be at least 0.");
assertThrow(getSimStart() < getSimDuration(),
Expand Down

0 comments on commit 60cbeeb

Please sign in to comment.