philippkraft / cmf Goto Github PK
View Code? Open in Web Editor NEWCatchment Modelling Framework, a hydrologic modelling toolbox
Home Page: https://philippkraft.github.io/cmf
License: GNU General Public License v3.0
Catchment Modelling Framework, a hydrologic modelling toolbox
Home Page: https://philippkraft.github.io/cmf
License: GNU General Public License v3.0
With using the __geo_interface__
, the cells_from_polygons function will get a complete rewrite with API change. The callables are hard to explain and ugly to use.
Python does not know how to pickle cmf.timeseries.
__getstate__
and __setstate__
for timeseries returning the buffer or a dict of the characteristics.begin
and step
writableNew CMF Version throws error on install on skylla.
[sf1962@skylla1 ~]$ pip install cmf --upgrade --user
Collecting cmf
Using cached cmf-1.0.4.tar.gz
Building wheels for collected packages: cmf
Running setup.py bdist_wheel for cmf ... error
Complete output from command /cm/shared/apps/python/3.5.0/bin/python3 -u -c "i mport setuptools, tokenize;file='/tmp/pip-build-1huce24n/cmf/setup.py';f=get attr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.clo se();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpl3rfuglopip-w heel- --python-tag cp35:
/cm/shared/apps/python/3.5.0/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/cmf
copying cmf/maps.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/fit_retention_curve.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/init.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/describe.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/jacobian.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/extend_project.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/geos_shapereader.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/soil.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/stopwatch.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/cell_factory.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/cmf_core.py -> build/lib.linux-x86_64-3.5/cmf
creating build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/hillplot.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/init.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/draw_misc.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/shapemap.py -> build/lib.linux-x86_64-3.5/cmf/draw
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'cmf._cmf_core' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/cmf
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/reach
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/atmosphere
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/geometry
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators/sundial s_cvode
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators/sundial s_cvode/src
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/water
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/vegetation
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/Soil
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/connections
gcc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall - Wstrict-prototypes -fPIC -Icmf/cmf_core_src/math/integrators/sundials_cvode/incl ude -I/home/sf1962/.local/lib/python3.5/site-packages/numpy/core/include -I/cm/s hared/apps/python/3.5.0/include/python3.5m -c cmf/cmf_core_src/cmf.cpp -o build/ temp.linux-x86_64-3.5/cmf/cmf_core_src/cmf.o -Wno-comment -Wno-reorder -Wno-unus ed -Wno-sign-compare -ggdb -std=c++11 -fopenmp
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/Obj C but not for C++ [enabled by default]
gcc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall - Wstrict-prototypes -fPIC -Icmf/cmf_core_src/math/integrators/sundials_cvode/incl ude -I/home/sf1962/.local/lib/python3.5/site-packages/numpy/core/include -I/cm/s hared/apps/python/3.5.0/include/python3.5m -c cmf/cmf_core_src/project.cpp -o bu ild/temp.linux-x86_64-3.5/cmf/cmf_core_src/project.o -Wno-comment -Wno-reorder - Wno-unused -Wno-sign-compare -ggdb -std=c++11 -fopenmp
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/Obj C but not for C++ [enabled by default]
In file included from cmf/cmf_core_src/atmosphere/meteorology.h:26:0,
from cmf/cmf_core_src/project.h:24,
from cmf/cmf_core_src/project.cpp:19:
cmf/cmf_core_src/atmosphere/../water/WaterStorage.h:22:35: fatal error: ../mat h/statevariable.h: No such file or directory
#include "../math/statevariable.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Failed building wheel for cmf
Running setup.py clean for cmf
Failed to build cmf
Installing collected packages: cmf
Found existing installation: cmf 1.0.3
Uninstalling cmf-1.0.3:
Successfully uninstalled cmf-1.0.3
Running setup.py install for cmf ... error
Complete output from command /cm/shared/apps/python/3.5.0/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-1huce24n/cmf/setup.py';f=g etattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.c lose();exec(compile(code, file, 'exec'))" install --record /tmp/pip-g1dnkoy7 -record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
/cm/shared/apps/python/3.5.0/lib/python3.5/distutils/dist.py:261: UserWarnin g: Unknown distribution option: 'python_requires'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/cmf
copying cmf/maps.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/fit_retention_curve.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/init.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/describe.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/jacobian.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/extend_project.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/geos_shapereader.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/soil.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/stopwatch.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/cell_factory.py -> build/lib.linux-x86_64-3.5/cmf
copying cmf/cmf_core.py -> build/lib.linux-x86_64-3.5/cmf
creating build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/hillplot.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/init.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/draw_misc.py -> build/lib.linux-x86_64-3.5/cmf/draw
copying cmf/draw/shapemap.py -> build/lib.linux-x86_64-3.5/cmf/draw
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'cmf._cmf_core' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/cmf
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/reach
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/atmosphere
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/geometry
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators/sundi als_cvode
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/math/integrators/sundi als_cvode/src
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/water
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/vegetation
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/Soil
creating build/temp.linux-x86_64-3.5/cmf/cmf_core_src/upslope/connections
gcc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Icmf/cmf_core_src/math/integrators/sundials_cvode/in clude -I/home/sf1962/.local/lib/python3.5/site-packages/numpy/core/include -I/cm /shared/apps/python/3.5.0/include/python3.5m -c cmf/cmf_core_src/cmf.cpp -o buil d/temp.linux-x86_64-3.5/cmf/cmf_core_src/cmf.o -Wno-comment -Wno-reorder -Wno-un used -Wno-sign-compare -ggdb -std=c++11 -fopenmp
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/O bjC but not for C++ [enabled by default]
gcc -pthread -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Icmf/cmf_core_src/math/integrators/sundials_cvode/in clude -I/home/sf1962/.local/lib/python3.5/site-packages/numpy/core/include -I/cm /shared/apps/python/3.5.0/include/python3.5m -c cmf/cmf_core_src/project.cpp -o build/temp.linux-x86_64-3.5/cmf/cmf_core_src/project.o -Wno-comment -Wno-reorder -Wno-unused -Wno-sign-compare -ggdb -std=c++11 -fopenmp
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/O bjC but not for C++ [enabled by default]
In file included from cmf/cmf_core_src/atmosphere/meteorology.h:26:0,
from cmf/cmf_core_src/project.h:24,
from cmf/cmf_core_src/project.cpp:19:
cmf/cmf_core_src/atmosphere/../water/WaterStorage.h:22:35: fatal error: ../m ath/statevariable.h: No such file or directory
#include "../math/statevariable.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of cmf
Command "/cm/shared/apps/python/3.5.0/bin/python3 -u -c "import setuptools, toke nize;file='/tmp/pip-build-1huce24n/cmf/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code , file, 'exec'))" install --record /tmp/pip-g1dnkoy7-record/install-record.t xt --single-version-externally-managed --compile --user --prefix=" failed with e rror code 1 in /tmp/pip-build-1huce24n/cmf/
Hello,
waterbalance_connection is ignoring other defined outflux from left node.
(trying the online tutorial as in the linked code, the flux_s3_s5
does not match with its definition - due to ignoration by waterbalance_connection). I also tried to change the order of the flux definitions - didn't fix the issue yet.
I expected waterbalance_connection to do this: flux_s3_s4 = flux_s1_s3 + flux_s2_s3 - flux_s3_s5 (see tutorial).
some things are strange with the tutorial for the waterbalance_connection, too:
I: in the online tutorial the initial volumes for s1 and s2 are missing
II:
flux_s1_to_s3 = [] flux_s2_to_s3 = [] #insert ','
flux_s3_to_s4 = [] flux_s3_to_s5 = [] #insert ','
plt.ylabel("Flux [m³/day]") plt.xlabel("Time [days]") #insert ','
Version 3.1.0 is much newer and supports sparse matrices
Installing on skylla throws error message:
pip install cmf --user --upgrade
Collecting cmf
Downloading cmf-1.1.1.tar.gz (2.4MB)
100% |████████████████████████████████| 2.4MB 225kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-6f6z0jeg/cmf/setup.py", line 211, in <module>
updateversion()
File "/tmp/pip-build-6f6z0jeg/cmf/setup.py", line 82, in updateversion
doxycode = open('Doxyfile').readlines()
FileNotFoundError: [Errno 2] No such file or directory: 'Doxyfile'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6f6z0jeg/cmf/
The docs are still on the server in the Uni using trac and are written in Wiki-Creole.
Move files from root directory to a tools directory or something similar
Using the StateVariableOwner as a public parent class of a bunch of things fits to a Java like inheritance concept but not to a Python extension. A template method of the Integrator to scan for statevariables should do.
Hello,
I am trying to run several cmf1D cells in parallel with the Python in-build package multiprocessing. When I am using a simple example everything works quite well (see attached file). But when I am trying to run a complex setup (not attached; the setup contains several sub-classes and input files and I like to clarify if this is a known issue before I upload the entire setup) an error is raised:
_"MaybeEncodingError: Error sending result: '<LandscapeModel.SubCatchment.SubCatchment object at 0x00000000052D4FD0>'. Reason: 'TypeError("can't pickle SwigPyObject objects",)'"
Any experience with this error? Seems to be related to the swig-wrapper.
Cheers,
Sebastian
With increasing size of my cmf.project.cell.area my CVodeIntegrator rises Error.
I could trace it back to the cmf.SimpleTindexSnowMelt() function. Itr seems like its not scaling properly to the cell size.
Write a tutorial that reflects a model consisting of several subcatchments with different rainfall stations and three landuse types
The neighbors property of Cell is not iterable in Python 3. Change of iterable protocol?
TypeError: 'neighbor_iterator' object is not an iterator
cell.set_Uptakestress does not set the uptake stress of the cell, instead it does a one time setting of all ET connection to use the uptakestress function. Not clear.
To solve this:
RootUptakeStessFunction
The current access to solute (here X
) storages of water storages (here WS
) is super ugly:
WS.Solute(X).state
This issue proposes a nicer access like:
WS[X].state
Additionally we can move the conc method from water storage to a property of the solute storage
WS[X].conc
The cmf.draw package was never really documented and is an old grown mess. Some refactoring and organizing is needed.
The potential transpiration rate PTR is reduced by the actual interception rate AIR- this is copied from BROOK90. However, AIR is derived from PIR with an own mechanism. This leads to a raise of ground evaporation GER if PIR>AIR>PTR. GER has the roughly same value for AIR=PIR>PTR and PIR>PTR>=AIR.
Let it flow contains deprecated ways to use cmf.
Remove all inline statements - possibly harmful for linking
Many hydrological models work with a fixed daily timestep, but processes like interception and surface runoff occur for a much shorter timestep. Every now and then CMF shows a "weird" behaviour, which is not weird at all, but just an artifact due to a too large timestep. We need a tutorial to help users select the "right" timestep in their solvers. And this means not too long.
Hello,
one question related to cmf.KinematicSurfaceRunoff. The description in the API says that "w is the width of the shared boundary between the surface water storage and the target node". For example, two storages are defined in the tutorial "surface runoff" (one cell and one outlet) which don't have a spatial extent, just only a location. So how is the parameter w calculated?
Cheers,
Sebastian
Using C flags for C++ can create warnings, this is already handled in setup.py:51-63. However, when gcc compiles C files from the CVODE solver, no there are warnings about using C++ flags on C code, eg. -std=C++11. On macOS with CLang, this produces errors and cmf is not compiled.
Oudin et al (2005, Which potential evapotranspiration input for a lumped
rainfall–runoff model?) developed an simple PET calculation method. This seems to be working very good for lumped conceptual models and also needs little forcing data (Mean Temperature and Radiation).
Might be worth including.
When testing test/solver.py, ImplicitEuler.integrate_until crashes
When running models on Skylla the problem occurs, that some runs never seem to finish. This causes the jobs to be killed after their assigned runtime is over, without ever finishing.
This has been happening when using Spotpy for calibration with the algorithms rope, MC and LHS.
Seems to be related to the beta value in kinematic waves. The smaller the value, the more runs never end. Values of beta > 0.5 do not seem to show this behaviour.
Related to:
thouska/spotpy#59
solver[-1]
results in segmentation fault. While fixing, include dynamic cast to specific statevariable.
having a (1D) model setup including:
A = valueA
B = valueB
cmf.external_control_connection(source, traget, A * source.volume^2 + B * source.volume)
I run it by
for t in solver.run(start, end, cmf.day):
but it doesn't seem to work.
could you please provide an excample how to use cmf.external_control_connection
using GIR in a simple model (attached file) with and without canopy cover results in
and
and
this makes me think GIR is potential evaporation of an openwater like storage (cell.surfacewater) in [mm/day] is this right?
But I can't find any formula in your API Documentaion or tutorials how it is calculated.
Could you please provide a more detailed description?
Until now, all tutorials follow a ceratain structure - however it is not well explained why this structure is important. And this can lead to confusion about storages not reacting to the dynamics (#32).
Hello,
seems like there is an error in the description of the Manning's equation (https://philippkraft.github.io/cmf/classcmf_1_1river_1_1_manning.html). I think the equation should look like this:
q_manning = (1/n_manning) * (A/P)(2/3) * (delta_z)(1/2)*A
Maybe split the calculation of the total flow (m3/sec) into the two calculation steps flow_velocity (m/s) and flow_rate (m³/sec):
flow_velocity = (1/n_manning) * (A/P)(2/3) * (delta_z)(1/2)
flow_rate = flow_velocity * A
Cheers,
Sebastian
Hello,
would be great to have a "TrapezialReachType" for simulating stream flow in addition to existing types as listed in the tutorial:
"If you create a reach for the project, you must give the crossectional geometry of the river. The different basic geometries are:
TriangularReach - T, a river with a triangular crosssection
SWATReachType - S, a river with a trapezoidal crossection, with a flat flood plain, as in the model SWAT
RectangularReach - R, a rectangular crosssection
PipeReach - P, a circular pipe
More crossection types can be implemented on demand."
Please find attached some examples of stream types which I am trying to simulate. The wet surface of the stream is a sensitive parameter I am interested in. The existing channel geometries are not sufficient to represent all of them and result in unrealistic estimates of the wet surface.
Cheers,
Sebastian
Current pypi version 1.3 fails to build on linux / mac os due casing problem of cmf_core_src/atmosphere/meteorology.h. Recreate package from linux. Workaround: Clone this repository and build from scratch with python setup.py install
Error in cmf.describe
cmf/describe.py in _describe_project(project, write)
91
92 def _describe_project(project, write):
---> 93 write(0, '{}'.format(project))
94 write()
95
cmf\describe.py in write(indent_level, text)
52 Helper function to write output to the out stream with identation
53 """
---> 54 out.write(' ' * indent_level + text + '\n')
55
56 def iterable(obj):
TypeError: unicode argument expected, got 'str'
I'm trying to install CMF on a unix machine, but when I try to install it I get the following error:
Using cached cmf-1.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-tnahe9m6/cmf/setup.py", line 211, in <module>
updateversion()
File "/tmp/pip-build-tnahe9m6/cmf/setup.py", line 82, in updateversion
doxycode = open('Doxyfile').readlines()
FileNotFoundError: [Errno 2] No such file or directory: 'Doxyfile'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-tnahe9m6/cmf/
I tried on different machines but I get the same error on both of them.
from cmf import fit_retention_curve
raises the follwoing error:
AttributeError: Unknown C global variable 'VERSION'
The scipy.optimize.fmin function tries unallowed values for the mf.VanGenuchtenMualem function and returns an RuntimeError.
Work arround excepet error and return high error for unallowed values.
def get_error_vgm(params,pF,theta):
try:
vgm=cmf.VanGenuchtenMualem(1.0, *params)
model_wetness=vgm.Wetness_pF(pF)
err = np.sum((theta - params[0] * model_wetness )**2)
except RuntimeError:
err = 999999999
return err
Hello,
I am using a really basic setup of CMF to simulate stream flow in a small number of river segments. The simulation of solely water fluxes is quit fast regarding performance. But when adding a tracer the simulation time increased by a factor of >200. I cannot figure out the reason for the large difference in performance when using CMF with and without a tracer (keeping in ind that the tracer flux is only conservative transport).
Would be great discuss this!
Cheers,
Sebastian
Dear Philipp,
thank you for this nice work. I tried to get CMF running on my machine but miserably failed to do so. Neither from source nor from pip, neither with Py3.6 nor with Py2.7 I can get gcc to compile. I actually guess it to be a compiler setting issue, but I do not see, where these are specified...
Could you point me to allow for optional compiler settings directing to a specific compiler (like gcc-8)?
Thank you.
Conrad
The geo_shapereader is not very smart and does not evolve. When I wrote it, there was no simple way to load shapefiles in Python - now there is: pyshp
__geo_interface___
in cell_factory, Related stack exchange: How to read a shapefile in Python?Some of the connection names in cmf are misleading. This issue is the place to collect these connections. If you find some connection name not really fitting (or if you dislike a proposal below), please write it here as a comment.
Starting with cmf 1.4, new names should be available as alternative (aka from future import), for cmf 2.0, the new names will be mandatory. For cmf 2.0 a tool to translate old scripts to the new names should be available.
Supporting Python 2 has two problems:
__future__
imports) and cannot be ported directly to Python 3.Hello,
I am interested in balancing surface water runoff for a single cell. For this, I have prepared a brief example consisting of only one cell with a surface water storage and other storage which collects the water from the sw-storage. The input parameters are Manning's roughness coefficient, the flowwidth and slope between storages. When comparing different parameter setups the impact of Manning's coefficient seems to be reasonable. But I wonder why the topographic slope has almost no impact on runoff generation. The slope needs to be greater than zero to have runoff, but then no further impact can be found.
As I understood CMF makes use of the St. Vernant equation, i.e. the root of the topographic gradient is divided by the Manning's roughness coefficient in the underlying equation. So, the impact of the slope might be very low on the resulting runoff. But is this feasible?
Cheers,
Sebastian
Most functions of retention curve except array-like parameters but raise an ValueError
when called with a scalar.
Message:
ValueError: object of too small depth for desired array
At a number of places, cmf needs to now which fration of a cell is covered by surfacewater, eg. Shuttleworth-Wallace to route ground evaporation either from the surface water or the first layer.
The cmf::upslope::Cell::surface_water_coverage function uses the undocumented "cmf::upslope::Cell::surface_amplitude" value. The puddle depth of the surfacewater has a similar function and is much cleaner.
constraint_kinematic_wave uses the suboptimal "residencetime" instead of a Q_0 approach.
The nice error reporting for not finite results in connections can render recoverable errors to be unrecoverable. By allowing some retries in a solver, calculations can become more robust
Change cmf.integrator.call(...) to the following:
def __init__(self, project, err_tol=1e-9, max_errors=10):
super().__init__(project, err_tol)
self.errors = []
self.max_errors = max_errors
def __call__(self, t, reset=False):
import sys
until = self.t + t if t < self.t else t
while self.t < until:
try:
self.integrate_until(until, reset=reset)
except RuntimeError as e:
if len(self.errors) < self.max_errors:
self.errors.append((self.t, e))
self.reset()
sys.stderr.write(str(e) + '\n')
else:
raise
return self.t
The states of the Technical Flux / Waterbalance Tutorials are confusing and need a total rewrite. Otherwise learning users do not understand the behaviour as #44 shows.
Hello,
I am working on the calculation of surface runoff for one cell with a given flow width and slope. I like to balance the runoff for each hourly time step. I am not sure about the right way to dothis, because the method "flux_to" is just a snapshot for the time of the function call. If the runoff event occurs in a time frame of less than a hour, one would miss the peak. Running the model with seconds as time step is no option. Another solution would be to use a virtual storage which collects all the water from the surface water storage and then to calculate the balance from the volume change. But I am not sure if I have implemented this correctly, because I couldn't create any runoff in my example.
Please find attached a test file.
Would be great to get help!
Sebastian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.