diff --git a/smoderp2d/core/general.py b/smoderp2d/core/general.py index 9c2c001e..9d69e719 100644 --- a/smoderp2d/core/general.py +++ b/smoderp2d/core/general.py @@ -205,7 +205,7 @@ class Globals: # raster contains critical water level mat_hcrit = None # raster contains parameter of power law for surface runoff - mat_aa = None + mat_a = None # raster contains parameter of power law for surface runoff mat_b = None # raster contains surface retention data @@ -314,9 +314,9 @@ def get_mat_hcrit(cls): return cls.mat_hcrit @classmethod - def get_mat_aa(cls): + def get_mat_a(cls): """TODO.""" - return cls.mat_aa + return cls.mat_a @classmethod def get_mat_b(cls): @@ -448,7 +448,7 @@ def reset(cls): # raster contains critical water level cls.mat_hcrit = None # raster contains parameter of power law for surface runoff - cls.mat_aa = None + cls.mat_a = None # raster contains parameter of power law for surface runoff cls.mat_b = None # raster contains surface retention data diff --git a/smoderp2d/core/surface.py b/smoderp2d/core/surface.py index a8a39c76..4b325bd5 100644 --- a/smoderp2d/core/surface.py +++ b/smoderp2d/core/surface.py @@ -129,7 +129,7 @@ def __init__(self): Globals.get_mat_reten(), Globals.get_mat_inf_index(), Globals.get_mat_hcrit(), - Globals.get_mat_aa(), + Globals.get_mat_a(), Globals.get_mat_b() ) diff --git a/smoderp2d/providers/base/data_preparation.py b/smoderp2d/providers/base/data_preparation.py index 4aed6de0..18c19989 100644 --- a/smoderp2d/providers/base/data_preparation.py +++ b/smoderp2d/providers/base/data_preparation.py @@ -24,9 +24,9 @@ def _get_a(mat_nsheet, mat_y, no_data, mat_slope): :param mat_y: :param no_data: no data value :param mat_slope: - :return: np ndarray for mat_aa + :return: np ndarray for mat_a """ - mat_aa = ma.where( + mat_a = ma.where( ma.logical_or( mat_nsheet == no_data, mat_y == no_data, mat_slope == no_data ), @@ -38,11 +38,11 @@ def _get_a(mat_nsheet, mat_y, no_data, mat_slope): ) ) - return mat_aa + return mat_a @staticmethod def _get_crit_water(mat_b, mat_tau, mat_v, r, c, mat_slope, - no_data_value, mat_aa): + no_data_value, mat_a): cond = ma.logical_and( mat_slope != no_data_value, mat_tau != no_data_value ) @@ -61,7 +61,7 @@ def _get_crit_water(mat_b, mat_tau, mat_v, r, c, mat_slope, mat_hcrit_v = ma.where( cond, - ma.where(mat_slope == 0, 1000, ma.power(mat_v / mat_aa, exp)), + ma.where(mat_slope == 0, 1000, ma.power(mat_v / mat_a, exp)), no_data_value ) @@ -70,7 +70,7 @@ def _get_crit_water(mat_b, mat_tau, mat_v, r, c, mat_slope, ma.where( mat_slope == 0, 1000, - ma.power(flux_crit / mat_slope / g / mat_aa, 1 / mat_b) + ma.power(flux_crit / mat_slope / g / mat_a, 1 / mat_b) ), no_data_value ) @@ -265,7 +265,7 @@ def __init__(self, writer): 'surface_retention': None, 'mat_inf_index': None, 'mat_hcrit': None, - 'mat_aa': None, + 'mat_a': None, 'mat_b': None, 'mat_reten': None, 'mat_fd': None, @@ -612,7 +612,7 @@ def run(self): self.data['mat_dem']) # build a/aa arrays - self.data['mat_aa'] = self._get_a( + self.data['mat_a'] = self._get_a( self.soilveg_fields['nsheet'], self.soilveg_fields['y'], GridGlobals.NoDataValue, self.data['mat_slope']) Logger.progress(50) @@ -622,7 +622,7 @@ def run(self): self.data['mat_b'], self.soilveg_fields['tau'], self.soilveg_fields['v'], GridGlobals.r, GridGlobals.c, self.data['mat_slope'], - GridGlobals.NoDataValue, self.data['mat_aa']) + GridGlobals.NoDataValue, self.data['mat_a']) self.storage.write_raster(self.data['mat_hcrit'], 'hcrit', 'control') # load precipitation input file diff --git a/smoderp2d/providers/profile1d/__init__.py b/smoderp2d/providers/profile1d/__init__.py index 0369dbf8..e86bc4f7 100644 --- a/smoderp2d/providers/profile1d/__init__.py +++ b/smoderp2d/providers/profile1d/__init__.py @@ -197,7 +197,7 @@ def _load_roff(self): # set values to parameter matrics data['mat_nrill'] = parsed_data['nrill'].reshape((data['r'], data['c'])) data['mat_b'] = parsed_data['b'].reshape((data['r'], data['c'])) - data['mat_aa'] = self._get_a( + data['mat_a'] = self._get_a( data['nsheet'], data['y'], data['NoDataValue'], @@ -210,7 +210,7 @@ def _load_roff(self): data['c'], data['mat_slope'], data['NoDataValue'], - data['mat_aa'] + data['mat_a'] ) data['mat_reten'] = parsed_data['ret'].reshape((data['r'], data['c'])) @@ -344,7 +344,6 @@ def _alloc_matrices(data): data['mat_inf_index'] = np.zeros((data['r'], data['c']), float) data['mat_fd'] = np.zeros((data['r'], data['c']), float) data['mat_hcrit'] = np.zeros((data['r'], data['c']), float) - data['mat_aa'] = np.zeros((data['r'], data['c']), float) data['mat_reten'] = np.zeros((data['r'], data['c']), float) data['mat_nan'] = np.zeros((data['r'], data['c']), float) data['mat_effect_cont'] = np.zeros((data['r'], data['c']), float) diff --git a/smoderp2d/time_step.py b/smoderp2d/time_step.py index 0646ec8a..ef6bf537 100644 --- a/smoderp2d/time_step.py +++ b/smoderp2d/time_step.py @@ -389,7 +389,7 @@ def do_next_h_implicit(self, surface, subsurface, rain_arr, cumulative, h_old = np.ravel(surface.arr.h_total_pre.tolist(0)) # Preparing the matrixes of flow parameters - aa = ma.array(Globals.get_mat_aa(), mask=GridGlobals.masks) + a = ma.array(Globals.get_mat_a(), mask=GridGlobals.masks) b = ma.array(Globals.get_mat_b(), mask=GridGlobals.masks) # Setting the initial guess for the solver h_0 = h_old @@ -436,7 +436,7 @@ def model_args(h_new): h_old, list_fd, r,c, - aa,b, + a,b, act_rain, surface.arr.soil_type, pixel_area, @@ -573,7 +573,7 @@ def model_args(h_new): #calculating sheet runoff _q_sheet, surface.arr.vol_runoff, surface.arr.vol_rest = ma.filled( - sheet_runoff(delta_t, aa, b, surface.arr.h_sheet), fill_value=0.0 + sheet_runoff(delta_t, a, b, surface.arr.h_sheet), fill_value=0.0 ) # Saving the inflows diff --git a/tests/data/nucice.save b/tests/data/nucice.save index d92e6a70..cad3ef54 100644 Binary files a/tests/data/nucice.save and b/tests/data/nucice.save differ diff --git a/tests/data/rain_sim.save b/tests/data/rain_sim.save index 56d408f9..db995e76 100644 Binary files a/tests/data/rain_sim.save and b/tests/data/rain_sim.save differ diff --git a/tests/data/reference/gistest_nucice/dpre/dpre.save b/tests/data/reference/gistest_nucice/dpre/dpre.save index d92e6a70..cad3ef54 100644 Binary files a/tests/data/reference/gistest_nucice/dpre/dpre.save and b/tests/data/reference/gistest_nucice/dpre/dpre.save differ diff --git a/tests/data/reference/gistest_rain_sim/dpre/dpre.save b/tests/data/reference/gistest_rain_sim/dpre/dpre.save index 56d408f9..db995e76 100644 Binary files a/tests/data/reference/gistest_rain_sim/dpre/dpre.save and b/tests/data/reference/gistest_rain_sim/dpre/dpre.save differ diff --git a/utils/convert-saved-data.py b/utils/convert-saved-data.py index e167edcb..d02dc6f5 100644 --- a/utils/convert-saved-data.py +++ b/utils/convert-saved-data.py @@ -23,20 +23,17 @@ def main(filename): 'delta_t': indata[13], 'mat_pi': indata[14], 'mat_ppl': indata[15], 'surface_retention': indata[16], 'mat_inf_index': indata[17], 'mat_hcrit': indata[18], - 'mat_aa': indata[19], 'mat_b': indata[20], - 'mat_reten': indata[21], 'mat_fd': indata[22], - 'mat_dmt': indata[23], 'mat_effect_cont': indata[24], - 'mat_slope': indata[25], 'mat_nan': indata[26], - 'mat_a': indata[27], 'mat_n': indata[28], - 'outdir': indata[29], 'pixel_area': indata[30], - 'points': indata[31], 'poradi': indata[32], - 'end_time': indata[33], 'spix': indata[34], - 'state_cell': indata[35], 'temp': indata[36], - 'type_of_computing': indata[37], 'vpix': indata[38], - 'mfda': indata[39], 'sr': indata[40], 'itera': indata[41], - 'toky': indata[42], 'cell_stream': indata[43], - 'mat_tok_reach': indata[44], 'STREAM_RATIO': indata[45], - 'toky_loc': indata[46] + 'mat_b': indata[19], 'mat_reten': indata[20], 'mat_fd': indata[21], + 'mat_dmt': indata[22], 'mat_effect_cont': indata[23], + 'mat_slope': indata[24], 'mat_nan': indata[25], 'mat_a': indata[26], + 'mat_n': indata[27], 'outdir': indata[28], 'pixel_area': indata[29], + 'points': indata[30], 'poradi': indata[31], 'end_time': indata[32], + 'spix': indata[33], 'state_cell': indata[34], 'temp': indata[35], + 'type_of_computing': indata[36], 'vpix': indata[37], + 'mfda': indata[38], 'sr': indata[39], 'itera': indata[40], + 'toky': indata[41], 'cell_stream': indata[42], + 'mat_tok_reach': indata[43], 'STREAM_RATIO': indata[44], + 'toky_loc': indata[45] } BaseProvider.save_data(data, filename)