Code Monkey home page Code Monkey logo

smoderp2d's Introduction

SMODERP2D

cmd_provider_consistency_test grass_provider_consistency_test

Distributed event-based model for surface and subsurface runoff and erosion.

    @ @ @   @       @     @ @     @ @ @     @ @ @ @  @ @ @    @ @ @
   @        @ @   @ @   @     @   @     @   @        @     @  @     @
   @        @   @   @  @       @  @      @  @        @     @  @     @
     @ @    @       @  @       @  @      @  @ @ @    @ @ @    @ @ @
         @  @       @  @       @  @      @  @        @   @    @
         @  @       @   @     @   @     @   @        @    @   @
    @ @ @   @       @     @ @     @ @ @     @ @ @ @  @     @  @
    \  \  /   / /    \   \  /   \  /    /     /       @ @ @   @ @ @
     \ _\/   /_/      \   \/     \/    /_____/       @     @  @     @
         \__/          \  /      _\___/                    @  @      @
             \____      \/      /                         @   @      @
                  \_____/______/                        @     @      @
                               \                      @       @     @
                                \___________________ @ @ @ @  @ @ @

User documentation: https://storm-fsv-cvut.github.io/smoderp2d-manual/

How to test

Download SMODERP2D source code to your computer.

git clone https://github.com/storm-fsv-cvut/smoderp2d.git

From Docker container

Build an image:

docker build \
 --tag smoderp2d:latest --file docker/Dockerfile .

Run SMODERP2D command line tool from Docker container:

docker run \
 -v `pwd`:/opt/smoderp2d -w /opt/smoderp2d/ --rm --entrypoint \
 ./bin/start-smoderp2d.py smoderp2d \
 --config tests/config_files/quicktest_stream_rill.ini

GRASS GIS

Build an image with GRASS GIS support:

docker build \
 --tag smoderp2d-grass:latest --file docker/grass/Dockerfile .

Run SMODERP2D with GRASS GIS provider from Docker container:

docker run \
 -v `pwd`:/opt/smoderp2d -w /opt/smoderp2d/ --rm --entrypoint \
 ./tests/run_grass_gistest.sh smoderp2d-grass \
 nucice

Run locally

Command line

PYTHONPATH=$PYTHONPATH:`pwd` ./bin/start-smoderp2d.py --config tests/config_files/quicktest_stream_rill.ini

QGIS

Requirements: QGIS 3.28.10 and higher

Define QGIS_PLUGINPATH and PYTHONPATH environmental variables in Settings -> Options -> System and restart QGIS.

Than enable SMODERP2D plugin in Plugins -> Manage and Install Plugins....

Alternatively set up environment variables in command line before starting QGIS:

PYTHONPATH=$PYTHONPATH:`pwd` QGIS_PLUGINPATH=`pwd`/bin/qgis qgis tests/data/nucice/qgis_project.qgz

smoderp2d's People

Contributors

jandevaty avatar jerabekjak avatar kalator avatar kavkapet avatar kubsta avatar landam avatar pesekon2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

smoderp2d's Issues

raise error if .ini file does not exist

if assign --indata file in cmd execution does not exist. Incorrect error is raised

Error raised:
ConfigParser.NoSectionError: No section: 'Other'

should be something line
IncorrectInitFile: file 'somefile ' is does not exist

change 3-d object surface.array to multiple 2-d matrices

Currently, we are using a 3-d object surface.array and subsurface.array for position-related variables in branch tf_smoderp. This is a reminiscent from loop-based computations and it is very unreadable. It would be better to rewrite it into x different 2-d matrices, where x is the length of the current third dimension.

Expected positives:

  • Easier to understand with which variable are we working
  • It is better to work with smaller arrays than with huge 28-times bigger multi-arrays

data providers: compare results created by ArcGIS and GRASS GIS

Data preparation

Raster (required)

  • rret
  • rpi
  • fl_dir
  • slope_inter
  • rs
  • rb
  • rtau
  • rk
  • rv
  • ratio_cell (almost, caused by aspect differences - few cells)
  • rppl
  • ry
  • rn
  • rx

Vector (required)

  • soil_b (more areas in grass)
  • vegetation_b (more areas in grass)

Raster (optional)

  • slope
  • fill
  • fldir
  • facc
  • dem_mask
  • inter_mask (different cats)
  • efect_cont (ratio_cell multiplied by spix) - (almost, see ratio_cell)

Vector (optional)

  • inter_soil_lu
  • dem_mask
  • points_inter (clipped input points)

Stream preparation

Raster (required)

  • stream_seg

Vector (required)

  • aoi (check: area)
  • aoi_buffer (check: area)
  • stream (check: sum length)
  • start (check: num of points)
  • end (check: num of points)

Raster (optional)

  • fill
  • slope
  • facc
  • fldir
  • setnull
  • stream_rst

Vector (optional)

qgis plugin: initial phase (import input data)

QGIS plugin must create temporal GRASS location and import input data before computation.

Inspiration:

Or alternatively:

import grass.script as gs
import sys
print (sys.argv[1])
# gs.run_command('v.import', input=sys.argv[1], output='xxx')
print (gs.gisenv())

->

grass -c EPSG:5514 /tmp/test2 --exec python test.py vstup1

grass providers fails on each second run

  File "./bin/grass/r.smoderp2d/../../../smoderp2d/providers/base/data_preparation.py", line 321, in _get_array_points_
    self.data['mat_dem'][r][c] != self.data['NoDataValue'] and \
IndexError: index 43 is out of bounds for axis 0 with size 39

qgis plugin prototype

Basic prototype

  • Data preparation
  • Interface for smoderp lib (GRASS provider will be probably used, #21 )
  • Display output data

Tasks

  • @kavkapet review tabs (how to split parameters)
  • @pesekon2 remove pickle file option
  • @pesekon2 new module to define labels (which will be used by QGIS, GRASS module and ArcGIS - see bin/arcgis/SMODERP2D.pyt -> getParameterInfo)
key - `inputSurfaceRaster`
label - _("Input surface raster")
label_cs - ?
section - None | "Settings"
data_type: raster | vector | column | int | float
tooltip: read from ArcGIS file
  • @kavkapet design soil tables (predefined tables)
  • @kavkapet which output data display (+ symbology)

Question: how to deal with localization?

Improvements

  • Graphs
  • ... ?

review output arrays values

ArcGIS Toolbox run with test data gives strange output data

VirtualBox_Windows 10 (ArcGIS Pro)_05_10_2019_15_36_41

While test from command line

./bin/start-smoderp2d.py --typecomp roff --indata tests/test.ini

gives different values (some make sense from first POV)

2019-10-05 16:17:20,232 - SMODERP2D - INFO - Array stats: min=0.0 max=0.00284423793801 mean=0.00138464882653 - [__init__:379]
2019-10-05 16:17:20,232 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/cInfil_m3.asc saved - [__init__:99]
2019-10-05 16:17:20,233 - SMODERP2D - INFO - Array stats: min=0.0 max=0.0143333333333 mean=0.00776388888889 - [__init__:379]
2019-10-05 16:17:20,233 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/cRain_m3.asc saved - [__init__:99]
2019-10-05 16:17:20,233 - SMODERP2D - INFO - Array stats: min=0.0 max=0.00534586330829 mean=0.00145814946429 - [__init__:379]
2019-10-05 16:17:20,233 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mVel_m_s.asc saved - [__init__:99]
2019-10-05 16:17:20,234 - SMODERP2D - INFO - Array stats: min=0.0 max=0.0518620497914 mean=0.015633564699 - [__init__:379]
2019-10-05 16:17:20,234 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mrSearStr_Pa.asc saved - [__init__:99]
2019-10-05 16:17:20,234 - SMODERP2D - INFO - Array stats: min=0.0 max=9.33323751905e-05 mean=2.04181664011e-05 - [__init__:379]
2019-10-05 16:17:20,234 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mQsur_m3_s.asc saved - [__init__:99]
2019-10-05 16:17:20,235 - SMODERP2D - INFO - Array stats: min=0.0 max=0.148485353763 mean=0.0326753520574 - [__init__:379]
2019-10-05 16:17:20,235 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/cVsur_m3.asc saved - [__init__:99]
2019-10-05 16:17:20,235 - SMODERP2D - INFO - Array stats: min=0.0 max=1.39237258423e-05 mean=5.44579206604e-06 - [__init__:379]
2019-10-05 16:17:20,235 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mQsheet_m3_s.asc saved - [__init__:99]
2019-10-05 16:17:20,236 - SMODERP2D - INFO - Array stats: min=0.0 max=0.00273906893225 mean=0.000583630068854 - [__init__:379]
2019-10-05 16:17:20,236 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mWLevelRill_m.asc saved - [__init__:99]
2019-10-05 16:17:20,237 - SMODERP2D - INFO - Array stats: min=0.0 max=7.94086531127e-05 mean=1.497236428e-05 - [__init__:379]
2019-10-05 16:17:20,237 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/mQRill_m3_s.asc saved - [__init__:99]
2019-10-05 16:17:20,238 - SMODERP2D - INFO - Array stats: min=0.0 max=0.0442320876233 mean=0.0118387686368 - [__init__:379]
2019-10-05 16:17:20,238 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/widthRill.asc saved - [__init__:99]
2019-10-05 16:17:20,238 - SMODERP2D - INFO - Array stats: min=0.0 max=0.137246258368 mean=0.0280351847523 - [__init__:379]
2019-10-05 16:17:20,238 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/cVIn_M3.asc saved - [__init__:99]
2019-10-05 16:17:20,239 - SMODERP2D - INFO - Array stats: min=0.0 max=0.00025 mean=0.000135416666667 - [__init__:379]
2019-10-05 16:17:20,239 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/surRet_M.asc saved - [__init__:99]
2019-10-05 16:17:20,239 - SMODERP2D - INFO - Array stats: min=0.0 max=0.0 mean=0.0 - [__init__:379]
2019-10-05 16:17:20,239 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/CumVRestL3.asc saved - [__init__:99]
2019-10-05 16:17:20,240 - SMODERP2D - INFO - Array stats: min=0.011662668472 max=3.40282346639e+38 mean=2.02042643317e+38 - [__init__:379]
2019-10-05 16:17:20,240 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/massBalance.asc saved - [__init__:99]
2019-10-05 16:17:20,241 - SMODERP2D - INFO - Array stats: min=-9999 max=1002 mean=-4446.55208333 - [__init__:379]
2019-10-05 16:17:20,241 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/reachFid.asc saved - [__init__:99]
2019-10-05 16:17:20,241 - SMODERP2D - INFO - Array stats: min=-3.40282346639e+38 max=0.0 mean=-2.02042643317e+38 - [__init__:379]
2019-10-05 16:17:20,241 - SMODERP2D - INFO - Raster ASCII output file tests/data/output/volRest_m3.asc saved - [__init__:99]

@jerabekjak Please review correctness of values.

Question on the necessity of a loop in TimeStep.do_flow

In TimeStep.do_flow is a loop through all the elements in surface.arr. But the whole method returns only potRain, which is computed before the time-consuming loop. So the question is: Is there any reason for the loop? Couldn't it be deleted?

The method also doesn't change any variable of the TimeStep object and my experiments didn't show any change in objects taken as parameters if that was the reason behind. But of course, there can be something I am missing.

Green-Ampt

Issue by jerabekjak
Tuesday Mar 27, 2018 at 09:34 GMT
Originally opened as jerabekjak/smoderp#13


Implementation of Green-Ampt infiltration equation for variable rainfall input.

  • [test ga for unsteady rainfall]
  • [unify precalc function in other infiltration classes (current precipitation height was added)]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.