The UFZ services GitLab and Mattermost will be unavailable on Monday, October 25 from 06:00 AM to 08:00 AM due to maintenance work.

Commit c6946ca5 authored by Sebastian Müller's avatar Sebastian Müller 🐈
Browse files

Merge branch 'develop' into '33-improve-speed'

# Conflicts:
#   cmake/.gitrepo
#   src/CMakeLists.txt
parents c1c4fd04 b23d024f
......@@ -91,6 +91,9 @@ ENV/
env.bak/
venv.bak/
# VSCode project settings
.vscode/
# Spyder project settings
.spyderproject
.spyproject
......
# Multiscale parameter regionalization -- MPR
# Multiscale parameter regionalization - MPR
- The current release is **[MPR v1.0.1][1]**.
<div align="center">
<img src="https://git.ufz.de/chs/logos/-/raw/master/MPR.png" alt="MPR-LOGO" width="251px" style="width:251px;"/>
</div>
- The current release is **[MPR v1.0.2][1]**.
- The latest MPR release notes can be found in the file [RELEASES][3] or [online][4].
- General information can be found on the [MPR website](https://www.ufz.de/index.php?en=40126).
- The MPR comes with a [LICENSE][6] agreement, this includes also the GNU Lesser General Public License.
......@@ -19,7 +23,7 @@ The online documentation for mHM can be found here (pdf versions are provided th
The model code can be cited as:
> Schweppe, R., S. Thober, M. Kelbling, R. Kumar, S. Attinger, and L. Samaniego (2021): MPR 1.0: A stand-alone Multiscale Parameter Regionalization Tool for Parameter Estimation of Land Surface Models, Geoscientific Model Development (submitted)
> Schweppe, R., S. Thober, M. Kelbling, R. Kumar, S. Attinger, and L. Samaniego (2021): MPR 1.0: A stand-alone Multiscale Parameter Regionalization Tool for Parameter Estimation of Land Surface Models, Geoscientific Model Development ([in discussion](https://editor.copernicus.org/GMD/ms-records/gmd-2021-103))
Please see the original publication of the MPR framework:
......@@ -29,7 +33,7 @@ Please see the original publication of the MPR framework:
The model code can be generally cited as:
> Schweppe, Robert, Thober, Stephan, Kelbling, Matthias, Kumar, Rohini, Attinger, Sabine, & Samaniego, Luis. (2021, March 31). Multiscale Parameter Regionalization tool -MPR v. 1.0 (Version 1.0). Zenodo. http://doi.org/10.5281/zenodo.4650513
> Schweppe, Robert, Thober, Stephan, Kelbling, Matthias, Kumar, Rohini, Attinger, Sabine, & Samaniego, Luis. (2021, March 31). Multiscale Parameter Regionalization tool -MPR v. 1.0 (Version 1.0). Zenodo. http://doi.org/10.5281/zenodo.4650513
To cite a certain version, have a look at the [Zenodo site][10].
......@@ -46,7 +50,7 @@ See also the [documentation][5] for detailed instructions to setup MPR.
3. Run MPR on the example via `./MPR`, which uses settings from [mpr.nml](mpr.nml).
[1]: https://git.ufz.de/chs/mpr/tree/1.0.0
[1]: https://git.ufz.de/chs/mpr/tree/1.0.2
[3]: doc/src/07_RELEASES.md
[4]: https://git.ufz.de/chs/mpr/tags/
[5]: https://chs.pages.ufz.de/mpr
......
......@@ -9,4 +9,9 @@
- reintegrated erroneously deleted tests for Python preproprocessors
- fixed some typos in README.md
- updated the hpc-module-loads subrepo
- activated documentation building for master branch by default as well
\ No newline at end of file
- activated documentation building for master branch by default as well
## MPR v1.0.2 (May 2021)
- updated the cmake_modules repository
- updated the lightweight_fortran_lib to forces
\ No newline at end of file
......@@ -132,5 +132,11 @@ parameter_names(67) = "PET_b"
parameter_values(67) = 1.5
parameter_names(68) = "PET_c"
parameter_values(68) = -0.7
parameter_names(69) = "FCmin_glob"
parameter_values(69) = 0.15
parameter_names(70) = "FCdelta_glob"
parameter_values(70) = 0.25
parameter_names(71) = "orgMatterSwitch"
parameter_values(71) = 0.0
/
/
\ No newline at end of file
This diff is collapsed.
......@@ -356,14 +356,16 @@ class TF(object):
# loop over each character from trigger to end of math_string
for index in range(index, len(math_string) + 1):
# continue statements are omitted in each if clause, only execute something in if-clauses
if open_parenthesis_counter == 0 and contained_parenthesis:
if math_string[index + index_addon] == ' ':
continue
elif open_parenthesis_counter == 0 and contained_parenthesis:
if trigger == 'if' and not math_string[index + index_addon:].startswith('then'):
raise Exception('The transfer function is not valid, a "then" needs to follow the',
'logical expression of an if-statement for transfer function:',
self.raw_tf_string)
# this code gets inserted, nice linebreak and indentation
insert_string = '{}{}{}'.format(
'{}\n'.format(insert_strig_dict1[trigger]),
' {}\n'.format(insert_strig_dict1[trigger]),
FORTRAN_INDENT * 3,
self.MATH_PREFIX_STRING)
math_string, index_addon = insert_line_break_in_math_string(
......@@ -414,8 +416,6 @@ class TF(object):
# index_addon += len(insert_string)
contains_pattern = None
break
elif math_string[index + index_addon] == ' ':
continue
elif math_string[index + index_addon] == char2:
open_parenthesis_counter -= 1
elif math_string[index + index_addon] == char1:
......
import re
import sys
comment = "!"
single_index_kw = ("name", "from_file", "to_file", "transfer_func")
multi_index_kw = (
"from_data_arrays",
"target_coord_names",
"upscale_ops",
"limits",
)
# file names given as CLI args
file_in = sys.argv[1]
file_out = sys.argv[2]
in_block = False
block_no = 0
with open(file_in, "r") as f_in:
lines = f_in.readlines()
with open(file_out, "w") as f_out:
for line in lines:
# copy comments
if line.lstrip().startswith(comment):
f_out.writelines([line])
continue
# copy anything outside data-array blocks
if not in_block and not line.lstrip().startswith("name"):
f_out.writelines([line])
continue
# check if we enter a block and if it is the first one
if not in_block and line.lstrip().startswith("name"):
in_block = True
block_no += 1
if in_block:
# block ends with empty line
if not line.strip():
in_block = False
f_out.writelines([line])
continue
# update single index
if line.lstrip().startswith(single_index_kw):
idx = line.index("=")
sub = re.sub(r"\((\d+)\)", f"({block_no})", line[:idx])
line = sub + line[idx:]
f_out.writelines([line])
# update latter multi-index
elif line.lstrip().startswith(multi_index_kw):
idx = line.index("=")
sub = re.sub(r",(\d+)\)", f",{block_no})", line[:idx])
line = sub + line[idx:]
f_out.writelines([line])
# write everything in between
else:
f_out.writelines([line])
......@@ -214,17 +214,17 @@ class TestTF:
func_result(:) = param(1) * exp ( ( param(2) + param(3) * x(1)%data_p(:) + param(4) * &
x(2)%data_p(:) ) * log ( param(5) ) )'''),
dedent('''\
where ( ( x(3)%data_p(:) + ( x(2)%data_p(:) - x(3)%data_p(:) ) / param(1) ) <= param(2) )
where ( ( x(3)%data_p(:) + ( x(2)%data_p(:) - x(3)%data_p(:) ) / param(1) ) <= param(2) )
func_result(:) = param(3)
else where
func_result(:) = param(4)
end where'''),
dedent('''\
where ( x(1)%data_p(:) > param(1) .and. x(1)%data_p(:) < param(2) )
where ( x(1)%data_p(:) > param(1) .and. x(1)%data_p(:) < param(2) )
func_result(:) = param(3)
else where ( x(1)%data_p(:) < param(4) )
else where ( x(1)%data_p(:) < param(4) )
func_result(:) = param(5)
else where ( x(1)%data_p(:) < param(6) )
else where ( x(1)%data_p(:) < param(6) )
func_result(:) = param(7)
else where
func_result(:) = nodata_dp
......@@ -247,15 +247,15 @@ class TestTF:
)
math_strings = (
dedent('''\
where ( x(1)%data_p(:) > param(1) )
where ( x(1)%data_p(:) > param(1) )
func_result(:) = x(1)%data_p(:)
else where
func_result(:) = x(2)%data_p(:)
end where'''),
dedent('''\
where ( x(1)%data_p(:) > param(1) )
where ( x(1)%data_p(:) > param(1) )
func_result(:) = x(1)%data_p(:)
else where ( x(1)%data_p(:) > param(2) )
else where ( x(1)%data_p(:) > param(2) )
func_result(:) = param(2)
else where
func_result(:) = x(2)%data_p(:)
......
1.0.1
\ No newline at end of file
1.0.2
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment