Skip to content

Commit

Permalink
Merge pull request #582 from LBL-EESA/mask_below_surface
Browse files Browse the repository at this point in the history
add elevation mask
burlen authored Apr 12, 2021
2 parents 55b555a + eed608a commit 8fef3f1
Showing 27 changed files with 2,511 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ env:
- BUILD_TYPE=Debug
- TECA_DIR=/travis_teca_dir
- TECA_PYTHON_VERSION=3
- TECA_DATA_REVISION=112
- TECA_DATA_REVISION=115
jobs:
- DOCKER_IMAGE=ubuntu IMAGE_VERSION=20.04 IMAGE_NAME=ubuntu_20_04 REQUIRE_NETCDF_MPI=TRUE
- DOCKER_IMAGE=ubuntu IMAGE_VERSION=20.04 IMAGE_NAME=ubuntu_20_04 REQUIRE_NETCDF_MPI=FALSE
2 changes: 2 additions & 0 deletions alg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -21,11 +21,13 @@ set(teca_alg_cxx_srcs
teca_component_statistics.cxx
teca_derived_quantity.cxx
teca_descriptive_statistics.cxx
teca_elevation_mask.cxx
teca_evaluate_expression.cxx
teca_face_to_cell_centering.cxx
teca_geography.cxx
teca_indexed_dataset_cache.cxx
teca_integrated_vapor_transport.cxx
teca_integrated_water_vapor.cxx
teca_l2_norm.cxx
teca_latitude_damper.cxx
teca_laplacian.cxx
32 changes: 19 additions & 13 deletions alg/teca_bayesian_ar_detect.cxx
Original file line number Diff line number Diff line change
@@ -608,7 +608,9 @@ void teca_bayesian_ar_detect::internals_t::clear()
teca_bayesian_ar_detect::teca_bayesian_ar_detect() :
min_component_area_variable("min_component_area"),
min_ivt_variable("min_water_vapor"),
hwhm_latitude_variable("hwhm_latitude"), thread_pool_size(1),
hwhm_latitude_variable("hwhm_latitude"),
ar_probability_variable("ar_probability"),
thread_pool_size(1),
internals(new internals_t)
{
this->set_number_of_input_connections(1);
@@ -631,18 +633,21 @@ void teca_bayesian_ar_detect::get_properties_description(

opts.add_options()
TECA_POPTS_GET(std::string, prefix, ivt_variable,
"name of the water vapor variable")
"Set the name of the integrated vaopr transport(IVT) variable to"
" compute AR probability from.")
TECA_POPTS_GET(std::string, prefix, min_component_area_variable,
"name of the column in the parameter table containing the "
"component area threshold")
"Set the name of the column in the parameter table containing the "
"minimum feature area threshold.")
TECA_POPTS_GET(std::string, prefix, min_ivt_variable,
"name of the column in the parameter table containing the "
"water vapor threshold")
"Set the name of the column in the parameter table containing the "
"minimum percentile IVT threshold.")
TECA_POPTS_GET(std::string, prefix, hwhm_latitude_variable,
"name of the column in the parameter table containing the "
"half width at half max latitude")
"Set the name of the column in the parameter table containing the "
"half width at half max latitude mask value.")
TECA_POPTS_GET(std::string, prefix, ar_probability_variable,
"Set the name of the variable to store the computed AR probability in.")
TECA_POPTS_GET(int, prefix, thread_pool_size,
"number of threads to parallelize execution over")
"Set the number of threads to parallelize execution over.")
;

this->teca_algorithm::get_properties_description(prefix, opts);
@@ -660,6 +665,7 @@ void teca_bayesian_ar_detect::set_properties(const std::string &prefix,
TECA_POPTS_SET(opts, std::string, prefix, min_component_area_variable)
TECA_POPTS_SET(opts, std::string, prefix, min_ivt_variable)
TECA_POPTS_SET(opts, std::string, prefix, hwhm_latitude_variable)
TECA_POPTS_SET(opts, std::string, prefix, ar_probability_variable)
TECA_POPTS_SET(opts, int, prefix, thread_pool_size)
TECA_POPTS_SET(opts, int, prefix, verbose)
}
@@ -809,7 +815,7 @@ teca_metadata teca_bayesian_ar_detect::get_output_metadata(
// report the variable that we compute, for each timestep from the
// parameter tables.
teca_metadata md(input_md[0]);
md.append("variables", std::string("ar_probability"));
md.append("variables", std::string(this->ar_probability_variable));

// add attributes to enable CF I/O
teca_metadata atts;
@@ -820,7 +826,7 @@ teca_metadata teca_bayesian_ar_detect::get_output_metadata(
0, "unitless", "posterior AR flag",
"the posterior probability of the presence of an atmospheric river");

atts.set("ar_probability", (teca_metadata)prob_atts);
atts.set(this->ar_probability_variable, (teca_metadata)prob_atts);

unsigned long num_params =
this->internals->parameter_table->get_number_of_rows();
@@ -879,7 +885,7 @@ std::vector<teca_metadata> teca_bayesian_ar_detect::get_upstream_request(
arrays.insert(this->ivt_variable);

// remove what we produce
arrays.erase("ar_probability");
arrays.erase(this->ar_probability_variable);
arrays.erase("ar_count");
arrays.erase("parameter_table_row");

@@ -1043,7 +1049,7 @@ const_p_teca_dataset teca_bayesian_ar_detect::execute(
// set up the reduction which computes the average over runs of all control
// parameter combinations provided in the parameter table
::parameter_table_reduction reduce(parameter_table_size,
"wv_cc", "ar_probability");
"wv_cc", this->ar_probability_variable);

p_teca_programmable_reduce pr = teca_programmable_reduce::New();
pr->set_name("parameter_table_reduce");
9 changes: 9 additions & 0 deletions alg/teca_bayesian_ar_detect.h
Original file line number Diff line number Diff line change
@@ -62,6 +62,14 @@ class teca_bayesian_ar_detect : public teca_algorithm
TECA_ALGORITHM_PROPERTY(std::string, min_component_area_variable)
TECA_ALGORITHM_PROPERTY(std::string, hwhm_latitude_variable)

/** @anchor probability variable
* @name probability variable
* Set the name of the variable to store output probability as.
*/
///@{
TECA_ALGORITHM_PROPERTY(std::string, ar_probability_variable)
///@}

// set/get the number of threads in the pool. setting
// to -1 results in a thread per core factoring in all MPI
// ranks running on the node. the default is -1.
@@ -99,6 +107,7 @@ class teca_bayesian_ar_detect : public teca_algorithm
std::string min_component_area_variable;
std::string min_ivt_variable;
std::string hwhm_latitude_variable;
std::string ar_probability_variable;
int thread_pool_size;

struct internals_t;
3 changes: 1 addition & 2 deletions alg/teca_cartesian_mesh_source.cxx
Original file line number Diff line number Diff line change
@@ -549,7 +549,7 @@ teca_metadata teca_cartesian_mesh_source::get_output_metadata(
z_atts.set("size", nz);

teca_metadata t_atts = this->t_axis_attributes;
t_atts.set("type_code", z_axis->type_code());
t_atts.set("type_code", t_axis->type_code());
t_atts.set("size", nt);

teca_metadata atts;
@@ -707,7 +707,6 @@ const_p_teca_dataset teca_cartesian_mesh_source::execute(unsigned int port,
std::string x_variable = this->x_axis_variable.empty() ? "x" : this->x_axis_variable;
std::string y_variable = this->y_axis_variable.empty() ? "y" : this->y_axis_variable;
std::string z_variable = this->z_axis_variable.empty() ? "z" : this->z_axis_variable;
std::string t_variable = this->t_axis_variable.empty() ? "t" : this->t_axis_variable;

mesh->set_x_coordinates(x_variable, out_x);
mesh->set_y_coordinates(y_variable, out_y);
Loading

0 comments on commit 8fef3f1

Please sign in to comment.