Index: examples/wflow_rhine_sbm/wflow_routing.ini =================================================================== diff -u -r817868557aba868707cbd4f13c39e90b6708d4f1 -re574688d9f85c8893b24b7e53e676bb2cd4f0763 --- examples/wflow_rhine_sbm/wflow_routing.ini (.../wflow_routing.ini) (revision 817868557aba868707cbd4f13c39e90b6708d4f1) +++ examples/wflow_rhine_sbm/wflow_routing.ini (.../wflow_routing.ini) (revision e574688d9f85c8893b24b7e53e676bb2cd4f0763) @@ -46,6 +46,6 @@ sizeinmetres = 0 [outputmaps] -self.SurfaceRunoff=run +self.SurfaceRunoff=_run #self.SubCellFrac=scf Index: wflow-py/notebooks/BMI-Test.ipynb =================================================================== diff -u -r88542a30670f441872d6c5f35c041e2e253127a1 -re574688d9f85c8893b24b7e53e676bb2cd4f0763 --- wflow-py/notebooks/BMI-Test.ipynb (.../BMI-Test.ipynb) (revision 88542a30670f441872d6c5f35c041e2e253127a1) +++ wflow-py/notebooks/BMI-Test.ipynb (.../BMI-Test.ipynb) (revision e574688d9f85c8893b24b7e53e676bb2cd4f0763) @@ -1,610 +1,234 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Basic test of the wflow BMI interface" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using matplotlib backend: Qt4Agg\n" - ] - } - ], - "source": [ - "import wflow.wflow_bmi as bmi\n", - "import logging\n", - "%matplotlib\n", - "reload(bmi)\n", - "%matplotlib inline \n", - "import datetime" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:32:57,658 - wflow_sbm.ini - WARNING - Could not read sample id-map for timeseries: /home/jaap/repos/wflow/examples/wflow_rhine_sbm/staticmaps/area.map\n", - "WARNING:wflow_sbm.ini:Could not read sample id-map for timeseries: /home/jaap/repos/wflow/examples/wflow_rhine_sbm/staticmaps/area.map\n", - "2015-05-19 18:32:57,670 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/RunoffGeneratingGWPerc.tbl) returning default value: 0.1\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/RunoffGeneratingGWPerc.tbl) returning default value: 0.1\n", - "2015-05-19 18:32:57,695 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/rootdistpar.tbl) returning default value: -8000\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/rootdistpar.tbl) returning default value: -8000\n", - "2015-05-19 18:32:57,702 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/CapScale.tbl) returning default value: 100.0\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/CapScale.tbl) returning default value: 100.0\n", - "2015-05-19 18:32:57,704 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/K4.tbl) returning default value: 0.02307\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/K4.tbl) returning default value: 0.02307\n", - "2015-05-19 18:32:57,721 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/MaxPercolation.tbl) returning default value: 0.0\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/MaxPercolation.tbl) returning default value: 0.0\n", - "2015-05-19 18:32:57,767 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/MporeFrac.tbl) returning default value: 0.0\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/MporeFrac.tbl) returning default value: 0.0\n", - "2015-05-19 18:32:57,790 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/WaterFrac.tbl) returning default value: 0.0\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/WaterFrac.tbl) returning default value: 0.0\n", - "2015-05-19 18:32:57,794 - wflow_sbm.ini - WARNING - tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/et_reftopot.tbl) returning default value: 1.0\n", - "WARNING:wflow_sbm.ini:tbl file not found (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/intbl/et_reftopot.tbl) returning default value: 1.0\n" - ] - } - ], - "source": [ - "# This is the LAnd Atmophere (LA) model\n", - "LA_model = bmi.wflowbmi_csdms()\n", - "LA_model.initialize('../../examples/wflow_rhine_sbm/wflow_sbm.ini',loglevel=logging.WARN)\n", - "\n", - "# This is the routing (LA) model\n", - "RT_model = bmi.wflowbmi_csdms()\n", - "RT_model.initialize('../../examples/wflow_rhine_sbm/wflow_routing.ini',loglevel=logging.WARN)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "t_end = RT_model.get_end_time()\n", - "t_start = RT_model.get_start_time()\n", - "t = RT_model.get_current_time()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "27.0" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "\n", - "(t_end - t_start)/(86400)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:06,368 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.001) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.001) for timestep not present, returning 75.0\n", - "2015-05-19 18:33:06,594 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1995-02-01 00:00:00\n", - "1995-02-02 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:06,804 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-03 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:07,013 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-04 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:07,222 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-05 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:07,431 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-06 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:07,667 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-07 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:07,879 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-08 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:08,087 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-09 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:08,298 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-10 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:08,526 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-11 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:08,734 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-12 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:08,955 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-13 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:09,159 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-14 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:09,376 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-15 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:09,578 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-16 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:09,801 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-17 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:10,013 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-18 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:10,227 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-19 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:10,426 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-20 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:10,627 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-21 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:10,830 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-22 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:11,027 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-23 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:11,227 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-24 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:11,442 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-25 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:11,654 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-26 00:00:00" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "2015-05-19 18:33:11,863 - wflow_sbm.ini - WARNING - Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n", - "WARNING:wflow_sbm.ini:Climatology data (/home/jaap/repos/wflow/examples/wflow_rhine_sbm/monthlyclim/ROOT0000.002) for timestep not present, returning 75.0\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "1995-02-27 00:00:00\n" - ] - } - ], - "source": [ - "t_end = RT_model.get_end_time()\n", - "t = RT_model.get_start_time()\n", - "\n", - "\n", - "\n", - "\n", - "while t < t_end:\n", - " LA_model.update()\n", - " # Now set the output from the LA model (specific Q) as input to the RT model\n", - " thevar = LA_model.get_value(\"InwaterMM\")\n", - " RT_model.set_value(\"IW\",thevar) # The IW is set in the wflow_routing.ini var as a forcing\n", - " RT_model.update()\n", - " t = RT_model.get_current_time()\n", - " \n", - " print datetime.datetime.fromtimestamp(t)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "LA_model.finalize()\n", - "RT_model.finalize()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.9" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Basic test of the wflow BMI interface" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Using matplotlib backend: Qt4Agg\n" + ] + } + ], + "source": [ + "import wflow.wflow_bmi as bmi\n", + "import logging\n", + "%matplotlib\n", + "reload(bmi)\n", + "%matplotlib inline \n", + "import datetime" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2015-05-27 15:10:31,680 - wflow_sbm.ini - WARNING - Could not read sample id-map for timeseries: c:\\repos\\wflow\\examples\\wflow_rhine_sbm/staticmaps/area.map\n", + "2015-05-27 15:10:31,680 - wflow_sbm.ini - WARNING - Could not read sample id-map for timeseries: c:\\repos\\wflow\\examples\\wflow_rhine_sbm/staticmaps/area.map\n", + "WARNING:wflow_sbm.ini:Could not read sample id-map for timeseries: c:\\repos\\wflow\\examples\\wflow_rhine_sbm/staticmaps/area.map\n", + "2015-05-27 15:10:31,707 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/RunoffGeneratingGWPerc.tbl) returning default value: 0.1\n", + "2015-05-27 15:10:31,707 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/RunoffGeneratingGWPerc.tbl) returning default value: 0.1\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/RunoffGeneratingGWPerc.tbl) returning default value: 0.1\n", + "2015-05-27 15:10:31,742 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/rootdistpar.tbl) returning default value: -8000\n", + "2015-05-27 15:10:31,742 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/rootdistpar.tbl) returning default value: -8000\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/rootdistpar.tbl) returning default value: -8000\n", + "2015-05-27 15:10:31,752 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/CapScale.tbl) returning default value: 100.0\n", + "2015-05-27 15:10:31,752 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/CapScale.tbl) returning default value: 100.0\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/CapScale.tbl) returning default value: 100.0\n", + "2015-05-27 15:10:31,759 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/K4.tbl) returning default value: 0.02307\n", + "2015-05-27 15:10:31,759 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/K4.tbl) returning default value: 0.02307\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/K4.tbl) returning default value: 0.02307\n", + "2015-05-27 15:10:31,776 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MaxPercolation.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,776 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MaxPercolation.tbl) returning default value: 0.0\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MaxPercolation.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,858 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MporeFrac.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,858 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MporeFrac.tbl) returning default value: 0.0\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/MporeFrac.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,885 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/WaterFrac.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,885 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/WaterFrac.tbl) returning default value: 0.0\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/WaterFrac.tbl) returning default value: 0.0\n", + "2015-05-27 15:10:31,890 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/et_reftopot.tbl) returning default value: 1.0\n", + "2015-05-27 15:10:31,890 - wflow_sbm.ini - WARNING - tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/et_reftopot.tbl) returning default value: 1.0\n", + "WARNING:wflow_sbm.ini:tbl file not found (c:\\repos\\wflow\\examples\\wflow_rhine_sbm/intbl/et_reftopot.tbl) returning default value: 1.0\n" + ] + } + ], + "source": [ + "# This is the LAnd Atmophere (LA) model\n", + "LA_model = bmi.wflowbmi_csdms()\n", + "LA_model.initialize('../../examples/wflow_rhine_sbm/wflow_sbm.ini',loglevel=logging.WARN)\n", + "\n", + "# This is the routing (LA) model\n", + "RT_model = bmi.wflowbmi_csdms()\n", + "RT_model.initialize('../../examples/wflow_rhine_sbm/wflow_routing.ini',loglevel=logging.WARN)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "t_end = RT_model.get_end_time()\n", + "t_start = RT_model.get_start_time()\n", + "t = RT_model.get_current_time()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "27.0" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "(t_end - t_start)/(86400)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1995-02-01 00:00:00\n", + "1995-02-02 00:00:00\n", + "1995-02-03 00:00:00\n", + "1995-02-04 00:00:00\n", + "1995-02-05 00:00:00\n", + "1995-02-06 00:00:00\n", + "1995-02-07 00:00:00\n", + "1995-02-08 00:00:00\n", + "1995-02-09 00:00:00\n", + "1995-02-10 00:00:00\n", + "1995-02-11 00:00:00\n", + "1995-02-12 00:00:00\n", + "1995-02-13 00:00:00\n", + "1995-02-14 00:00:00\n", + "1995-02-15 00:00:00\n", + "1995-02-16 00:00:00\n", + "1995-02-17 00:00:00\n", + "1995-02-18 00:00:00\n", + "1995-02-19 00:00:00\n", + "1995-02-20 00:00:00\n", + "1995-02-21 00:00:00\n", + "1995-02-22 00:00:00\n", + "1995-02-23 00:00:00\n", + "1995-02-24 00:00:00\n", + "1995-02-25 00:00:00\n", + "1995-02-26 00:00:00\n", + "1995-02-27 00:00:00\n" + ] + } + ], + "source": [ + "t_end = RT_model.get_end_time()\n", + "t = RT_model.get_start_time()\n", + "\n", + "\n", + "\n", + "# Loop in time and put output of SBM in seperate routing module - 1way link\n", + "while t < t_end:\n", + " LA_model.update()\n", + " # Now set the output from the LA model (specific Q) as input to the RT model\n", + " thevar = LA_model.get_value(\"InwaterMM\")\n", + " RT_model.set_value(\"IW\",thevar) # The IW is set in the wflow_routing.ini var as a forcing\n", + " RT_model.update()\n", + " t = RT_model.get_current_time()\n", + " \n", + " print datetime.datetime.fromtimestamp(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "LA_model.finalize()\n", + "RT_model.finalize()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.8" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}