Skip to content

Commit

Permalink
Rename "measure" to "intervention" (#122)
Browse files Browse the repository at this point in the history
* rename "measure" to "intervention" ... except for the WithMeasure keyword in the configuration file
* Update "WithMeasure" to "WithIntervention" in all version 3 (and 2) configuration files.

---------

Co-authored-by: hrajagers <hrajagers@users.noreply.github.com>
  • Loading branch information
hrajagers and hrajagers committed Jul 11, 2024
1 parent 4117e97 commit fb60dfc
Show file tree
Hide file tree
Showing 64 changed files with 548 additions and 1,040 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ For more details see the documentation section.

## Documentation

The documentation consists of
* a LaTeX user manual including scientific description, and developer starter guide (also in this readme)
* a [Technical Reference Manual](docs/techref.md) in Markdown
the sources of both documents can be found in the `docs` folder.
The documentation is written in LaTeX, and consists of
* User Manual including scientific description, and
* Technical Reference Manual including developer starter guide (also in this readme), test plan, and test report, and
* Release Notes.
The sources of all three documents can be found in the `docs` folder.

## Developer user starter guide
1. install python 3
Expand Down
2 changes: 1 addition & 1 deletion dfastmi/batch/AFileNameRetriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_file_names(
-------
filenames : Dict[Any, Tuple[str,str]]
Dictionary of string tuples representing the D-Flow FM file names for
each reference/with measure pair.
each reference/with intervention pair.
"""

def _cfg_get(self, config: configparser.ConfigParser, chap: str, key: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion dfastmi/batch/AnalyserAndReporterDflowfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def analyse_and_report_dflowfm(
Dictionary of the names of the data file containing the simulation
results to be processed. The conditions (discharge, wave conditions,
...) are the key in the dictionary. Per condition a tuple of two file
names is given: a reference file and a file with measure.
names is given: a reference file and a file with intervention.
xykm : shapely.geometry.linestring.LineString
Original river chainage line.
old_zmin_zmax : bool
Expand Down
16 changes: 8 additions & 8 deletions dfastmi/batch/AnalyserDflowfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def analyse(
Dictionary of the names of the data file containing the simulation
results to be processed. The conditions (discharge, wave conditions,
...) are the key in the dictionary. Per condition a tuple of two file
names is given: a reference file and a file with measure.
names is given: a reference file and a file with intervention.
xykm : shapely.geometry.linestring.LineString
Original river chainage line.
plotting_options : PlotOptions
Expand Down Expand Up @@ -256,7 +256,7 @@ def _get_first_fm_data_filename(self, filenames: Dict[Any, Tuple[str, str]]) ->
)

if one_fm_filename is None:
self._reporter.print_measure_not_active_for_checked_conditions()
self._reporter.print_intervention_not_active_for_checked_conditions()
self._missing_data = True

return one_fm_filename
Expand All @@ -281,7 +281,7 @@ def _get_first_fm_data_filename_based_on_conditions_keys(
if not self._missing_data and self._discharges[i] is not None:
key, q, t = self._get_condition_key(self._discharges, self._tide_bc, i)
if self._rsigma[i] == 1 or self._discharges[i] <= self._q_threshold:
# no celerity or measure not active, so ignore field
# no celerity or intervention not active, so ignore field
pass
elif key in filenames:
return filenames[key][0]
Expand Down Expand Up @@ -328,7 +328,7 @@ def _get_dzq_based_on_numbered_keys(
# ignore period
dzq[i] = 0
elif self._discharges[i] <= self._q_threshold:
# measure inactive, so zero-effect for this period
# intervention inactive, so zero-effect for this period
dzq[i] = numpy.zeros_like(iface, dtype=float)
else:
dzq[i] = self._get_values_fm(
Expand All @@ -353,7 +353,7 @@ def _get_dzq_based_on_conditions_keys(
else:
key, q, t = self._get_condition_key(self._discharges, self._tide_bc, i)
if q <= self._q_threshold:
# measure inactive, so zero-effect for this period
# intervention inactive, so zero-effect for this period
dzq[i] = numpy.zeros_like(iface, dtype=float)
elif key in filenames.keys():
if t:
Expand Down Expand Up @@ -397,7 +397,7 @@ def _get_values_fm(
ucrit : float
Critical flow velocity.
filenames : Tuple[str, str]
Names of the reference simulation file and file with the implemented measure.
Names of the reference simulation file and file with the implemented intervention.
n_fields : int
Number of fields to process (e.g. to cover a tidal period).
dx : numpy.ndarray
Expand All @@ -420,7 +420,7 @@ def _get_values_fm(
self._reporter.report_file_not_found(filenames[0])
return None

# file with measure implemented
# file with intervention implemented
if not os.path.isfile(filenames[1]):
self._reporter.report_file_not_found(filenames[1])
return None
Expand Down Expand Up @@ -454,7 +454,7 @@ def _get_values_fm(
"sea_floor_depth_below_sea_surface", time_index_from_last=ifld
)[iface]

# data with measure
# data with intervention
u1 = map_file2.read_face_variable(
"sea_water_x_velocity", time_index_from_last=ifld
)[iface]
Expand Down
4 changes: 2 additions & 2 deletions dfastmi/batch/DflowfmReporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def report_file_not_found(self, filename):
def print_riverkm_needed_for_tidal(self):
print("RiverKM needs to be specified for tidal applications.")

def print_measure_not_active_for_checked_conditions(self):
print("The measure is not active for any of the checked conditions.")
def print_intervention_not_active_for_checked_conditions(self):
print("The intervention is not active for any of the checked conditions.")


class ReporterDflowfmReporter:
Expand Down
6 changes: 3 additions & 3 deletions dfastmi/batch/FileNameRetriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_file_names(
-------
filenames : Dict[Any, Tuple[str,str]]
Dictionary of string tuples representing the D-Flow FM file names for
each reference/with measure pair. The keys of the dictionary vary. They
each reference/with intervention pair. The keys of the dictionary vary. They
can be the discharge index, discharge value or a tuple of forcing
conditions, such as a Discharge and Tide forcing tuple.
"""
Expand All @@ -87,12 +87,12 @@ def get_file_names(
) from exc

reference = self._cfg_get(config, section, "Reference")
measure = self._cfg_get(config, section, "WithMeasure")
intervention = self._cfg_get(config, section, "WithIntervention")
if self.needs_tide:
T = self._cfg_get(config, section, "TideBC")
key = (Q, T)
else:
key = Q
filenames[key] = (reference, measure)
filenames[key] = (reference, intervention)

return filenames
6 changes: 3 additions & 3 deletions dfastmi/batch/FileNameRetrieverLegacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_file_names(
-------
filenames : Dict[Any, Tuple[str,str]]
Dictionary of string tuples representing the D-Flow FM file names for
each reference/with measure pair. The keys of the dictionary vary. They
each reference/with intervention pair. The keys of the dictionary vary. They
can be the discharge index, discharge value or a tuple of forcing
conditions, such as a Discharge and Tide forcing tuple.
"""
Expand All @@ -64,7 +64,7 @@ def get_file_names(
qstr = f"Q{i+1}"
if qstr in config:
reference = self._cfg_get(config, qstr, "Reference")
measure = self._cfg_get(config, qstr, "WithMeasure")
filenames[i] = (reference, measure)
intervention = self._cfg_get(config, qstr, "WithMeasure")
filenames[i] = (reference, intervention)

return filenames
2 changes: 1 addition & 1 deletion dfastmi/batch/Projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _project_one_xy_point_onto_line(
xyline : numpy.ndarray
Array containing the x,y data of a line.
sline : numpy.ndarray
Array containing the distance measure along the line xyline.
Array containing the distance intervention along the line xyline.
last_node : int
Index of the last node: xyline.shape[0] - 1
Expand Down
24 changes: 12 additions & 12 deletions dfastmi/batch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ def _report_used_file_names(
else:
key = q

condition, reference_file_name, measure_file_name, comment = (
condition, reference_file_name, intervention_file_name, comment = (
get_analysis_condition_values_for_logging(
initialized_config, filenames, q, key
)
)

_report_analysis_conditions_values(
condition, reference_file_name, measure_file_name, comment, report
condition, reference_file_name, intervention_file_name, comment, report
)


Expand All @@ -283,19 +283,19 @@ def get_analysis_condition_values_for_logging(

if q <= initialized_config.q_threshold:
reference_file_name = "---"
measure_file_name = "---"
comment = "(measure not active)"
intervention_file_name = "---"
comment = "(intervention not active)"
elif key in filenames:
files = filenames[key]
reference_file_name = _get_file_name(files[0])
measure_file_name = _get_file_name(files[1])
intervention_file_name = _get_file_name(files[1])
comment = ""
else:
reference_file_name = "xxx"
measure_file_name = "xxx"
intervention_file_name = "xxx"
comment = "(not specified)"

return condition, reference_file_name, measure_file_name, comment
return condition, reference_file_name, intervention_file_name, comment


def _get_file_name(location: str) -> str:
Expand All @@ -304,12 +304,12 @@ def _get_file_name(location: str) -> str:


def _report_analysis_conditions_values(
condition: str, reference: str, measure: str, comment: str, report: TextIO
condition: str, reference: str, intervention: str, comment: str, report: TextIO
):
settings = {
"condition": condition,
"reference": reference,
"measure": measure,
"intervention": intervention,
"comment": comment,
}
ApplicationSettingsHelper.log_text(
Expand Down Expand Up @@ -523,7 +523,7 @@ def get_filenames(
-------
filenames : Dict[Any, Tuple[str,str]]
Dictionary of string tuples representing the D-Flow FM file names for
each reference/with measure pair. The keys of the dictionary vary. They
each reference/with intervention pair. The keys of the dictionary vary. They
can be the discharge index, discharge value or a tuple of forcing
conditions, such as a Discharge and Tide forcing tuple.
"""
Expand Down Expand Up @@ -722,9 +722,9 @@ def write_report(
q_location : str
The name of the discharge location.
q_threshold : Optional[float]
The discharge below which the measure is not flow-carrying (None if always flowing above 1000 m3/s or when barriers are opened).
The discharge below which the intervention is not flow-carrying (None if always flowing above 1000 m3/s or when barriers are opened).
q_bankull : float
The discharge at which the measure is bankfull.
The discharge at which the intervention is bankfull.
q_stagnant : float
Discharge below which the river flow is negligible.
tstag : float
Expand Down
10 changes: 5 additions & 5 deletions dfastmi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ def _interactive_get_discharges(
q_location : str
Name of the location at which the discharge is
q_threshold : Optional[float]
River discharge at which the measure becomes active.
River discharge at which the intervention becomes active.
q_bankfull : float
River discharge at which the measure is bankfull.
River discharge at which the intervention is bankfull.
q_fit : Tuple[float, float]
A discharge and dicharge change determining the discharge exceedance curve (from rivers configuration file).
q_stagnant : float
Expand All @@ -364,7 +364,7 @@ def _interactive_get_discharges(
q_levels = reach.qlevels
dq = reach.dq

ApplicationSettingsHelper.log_text("intro-measure")
ApplicationSettingsHelper.log_text("intro-intervention")
if q_stagnant > q_fit[0]:
ApplicationSettingsHelper.log_text("query_flowing_when_barriers_open")
else:
Expand Down Expand Up @@ -590,9 +590,9 @@ def _write_report_nodata(
q_location : str
Name of the location at which the discharge is
q_threshold : Optional[float]
River discharge at which the measure becomes active.
River discharge at which the intervention becomes active.
q_bankfull : float
River discharge at which the measure is bankfull.
River discharge at which the intervention is bankfull.
q_stagnant : float
Discharge below which the river flow is negligible.
tstag : float
Expand Down
2 changes: 1 addition & 1 deletion dfastmi/config/AConfigurationInitializerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def rsigma(self) -> Vector:

@property
def q_threshold(self) -> float:
"""River discharge at which the measure becomes active [m3/s]."""
"""River discharge at which the intervention becomes active [m3/s]."""
return self._q_threshold

@property
Expand Down
8 changes: 4 additions & 4 deletions dfastmi/config/ConfigFileOperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _config_to_relative_paths(
ConfigFileOperations._update_to_relative_path(
rootdir, config, qstr, "Reference"
)
if "WithMeasure" in config[qstr]:
if "WithIntervention" in config[qstr]:
ConfigFileOperations._update_to_relative_path(
rootdir, config, qstr, "WithMeasure"
rootdir, config, qstr, "WithIntervention"
)
return config

Expand Down Expand Up @@ -298,9 +298,9 @@ def _config_to_absolute_paths(
ConfigFileOperations._update_to_absolute_path(
rootdir, config, qstr, "Reference"
)
if "WithMeasure" in config[qstr]:
if "WithIntervention" in config[qstr]:
ConfigFileOperations._update_to_absolute_path(
rootdir, config, qstr, "WithMeasure"
rootdir, config, qstr, "WithIntervention"
)
return config

Expand Down
2 changes: 1 addition & 1 deletion dfastmi/config/ConfigurationChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _check_configuration_cond(
)
return_value = (
self._check_key_with_file_value_and_set_return_value_if_needed(
config, return_value, condition, "WithMeasure"
config, return_value, condition, "WithIntervention"
)
)
else:
Expand Down
6 changes: 3 additions & 3 deletions dfastmi/config/ConfigurationInitializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_bed_celerity(reach: Reach, discharges: Vector) -> Vector:
all_zero = False
if all_zero:
raise ValueError(
"The celerities can't all be equal to zero for a measure to have any impact!"
"The celerities can't all be equal to zero for a intervention to have any impact!"
)

return celerity
Expand Down Expand Up @@ -227,7 +227,7 @@ def calculate_time_mi(
reach : Reach
The reach we want to get the levels from.
q_threshold : float
Threshold discharge above which the measure is active.
Threshold discharge above which the intervention is active.
discharges : Vector
A vector of discharges (Q) included in hydrograph [m3/s].
Expand Down Expand Up @@ -281,7 +281,7 @@ def set_times(
q_stagnant : float
A discharge below which the river flow is negligible.
q_threshold : float
Discharge below which the measure has no effect (due to measure design) [m3/s].
Discharge below which the intervention has no effect (due to intervention design) [m3/s].
Results
-------
Expand Down
8 changes: 4 additions & 4 deletions dfastmi/config/ConfigurationInitializerLegacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,22 @@ def _get_q_bankfull_from_config(
self, config: ConfigParser, q_threshold: Optional[float], q_levels: List[float]
) -> float:
"""
Get the simulation discharge at which measure reaches bankfull
Get the simulation discharge at which intervention reaches bankfull
from configuration in batch mode (no user interaction).
Arguments
---------
config : ConfigParser
Configuration of the analysis to be run.
q_threshold : Optional[float]
River discharge at which the measure becomes active
River discharge at which the intervention becomes active
q_levels :
Characteristic discharges used by algorithm [m3/s].
Results
-------
q_bankfull : float
River discharge at which the measure is bankfull [m3/s].
River discharge at which the intervention is bankfull [m3/s].
"""
q_bankfull = 0.0
if q_threshold is None or q_threshold < q_levels[1]:
Expand All @@ -202,7 +202,7 @@ def _get_q_threshold_from_config(self, config: ConfigParser) -> Optional[float]:
Results
-------
q_threshold : Optional[float]
River discharge at which the measure becomes active [m3/s].
River discharge at which the intervention becomes active [m3/s].
"""

q_threshold = config.get("General", "Qthreshold", fallback="")
Expand Down
Loading

0 comments on commit fb60dfc

Please sign in to comment.