Skip to content

Commit 7549f9a

Browse files
mabesamabesa
authored andcommitted
Initial submit
Cleaned up version of model_RainfallRunoffZhang. A openDA module that demonstrates the black box model wrapping with a matlab example.
0 parents  commit 7549f9a

File tree

1,462 files changed

+294095
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,462 files changed

+294095
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# ignore everything in this directory
2+
#[^.]*
3+
4+
# ignore these directories
5+
/bin/
6+
/bin_external/
7+
/build/
8+
/build-test/
9+
/javadoc/
10+
11+
bild_backup.xml
12+
13+
# Compiled source
14+
*.class
15+
*.dll
16+
*.o
17+
*.so
18+
19+
# packages
20+
*.7z
21+
*.dmg
22+
*.gz
23+
*.iso
24+
*.jar
25+
*.rar
26+
*.tar
27+
*.zip
28+
29+
# logs and databases
30+
*.log
31+
*.sql
32+
*.sqlite
33+
34+
# OS generated files
35+
.DS_Store
36+
.DS_Store?
37+
._*
38+
.Spotlight-V100
39+
.Trashes
40+
ehthumbs.db
41+
Thumbs.db
42+
43+
# eclipse generated files
44+
.classpath
45+
.project

MANIFEST.MF

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Manifest-Version: 1.0
2+
Ant-Version: Apache Ant 1.9.2
3+
Created-By: 1.8.0_45-b14 (Oracle Corporation)
4+
Title: OpenDA
5+
Version: 2.0.-1 July 20 2015
6+
Vendor: hydrosolutions ltd.
7+

README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The module model_RainfallRunoffZhang contains wrappers for an example rainfall runoff model that is programmed in matlab. The wrapper and model (available in tests/model/bin) have been tested extensively.
2+
3+
Ant is used to build the jars. The description of how to build the module is given in the openDA documentation.
4+
5+
author: Beatrice Marti, hydrosolutions ltd., marti@hydrosolutions.ch

build.xml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<project name="model_RainfallRunoffZhang" default="help" basedir=".">
2+
<!--
3+
================================================================================
4+
Ant build file for openda java code
5+
install ant and type
6+
"ant help"
7+
for a list of options
8+
================================================================================
9+
-->
10+
<target name="help">
11+
<echo>
12+
ant help --> print this help
13+
ant build --> compile, make jar and copy resources
14+
ant build-test --> compile test classes
15+
ant clean --> remove output
16+
ant javadoc --> build javadoc
17+
</echo>
18+
</target>
19+
20+
<property file="module.properties"/>
21+
22+
<target name="debug">
23+
<echo>
24+
module=${module}
25+
srcdir=${srcdir}
26+
jarname=${jarname}
27+
builddir=${builddir}
28+
bindir=${bindir}
29+
</echo>
30+
</target>
31+
32+
<!--
33+
===========================================================================
34+
Compilation
35+
===========================================================================
36+
-->
37+
<target name="build" depends="jarfile">
38+
</target>
39+
40+
<target name="build-test" depends="init">
41+
<javac srcdir="${testdir}" destdir="${buildtestdir}" debug="${debug}" source="${source}" encoding="UTF-8" failonerror="${failonerror}" listfiles="${listfiles}" fork="yes" memoryInitialSize="${minmemory}" memoryMaximumSize="${maxmemory}" includeantruntime="false">
42+
<classpath>
43+
<fileset dir="${projectdir}">
44+
<include name="${projectlib}/*.jar"/>
45+
</fileset>
46+
</classpath>
47+
</javac>
48+
</target>
49+
50+
<target name="jarfile" depends="moduleclasses,manifest">
51+
<jar jarfile="${modulelibdir}/${jarname}" manifest="MANIFEST.MF">
52+
<fileset dir="${builddir}">
53+
<include name="**/*.class"/>
54+
<include name="**/*.gif"/>
55+
</fileset>
56+
</jar>
57+
</target>
58+
59+
<target name="moduleclasses" depends="init,copy-module-resources">
60+
<javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}" source="${source}" encoding="UTF-8" failonerror="${failonerror}" listfiles="${listfiles}" fork="yes" memoryInitialSize="${minmemory}" memoryMaximumSize="${maxmemory}" includeantruntime="false">
61+
<classpath>
62+
<fileset dir=".">
63+
<include name="${modulelibdir}/*.jar"/>
64+
</fileset>
65+
<fileset dir="${projectdir}">
66+
<include name="${projectlib}/*.jar"/>
67+
</fileset>
68+
</classpath>
69+
</javac>
70+
</target>
71+
72+
<target name="javadoc" depends="init">
73+
<javadoc destdir="${javadocdir}/${module}" verbose="yes" windowtitle="openDA.Module: ${module} Version: ${version}" source="${source}">
74+
<fileset dir="${srcdir}">
75+
<include name="**/*.java"/>
76+
</fileset>
77+
<classpath>
78+
<fileset dir="${srcdir}">
79+
</fileset>
80+
<fileset dir="${resourcesdir}">
81+
<include name="openda_core.jar"/>
82+
<include name="observers.jar"/>
83+
</fileset>
84+
</classpath>
85+
</javadoc>
86+
</target>
87+
88+
89+
<!--
90+
===========================================================================
91+
Tools: init, clean, etc.
92+
===========================================================================
93+
-->
94+
<target name="init" depends="clean">
95+
<tstamp/>
96+
<mkdir dir="${builddir}"/>
97+
<mkdir dir="${buildtestdir}"/>
98+
<mkdir dir="${modulebindir}"/>
99+
<mkdir dir="${modulelibdir}"/>
100+
<mkdir dir="${javadocdir}"/>
101+
</target>
102+
103+
<target name="clean">
104+
<delete dir="${modulebindir}"/>
105+
<delete dir="${modulelibdir}"/>
106+
<delete dir="${builddir}"/>
107+
<delete dir="${buildtestdir}"/>
108+
<delete dir="${javadocdir}"/>
109+
<delete file="MANIFEST.MF"/>
110+
</target>
111+
112+
<taskdef resource="org/tigris/subversion/svnant/svnantlib.xml">
113+
<classpath>
114+
<fileset dir="../core/java/resources/svnant-1.3.0/lib" includes="**/*.jar" />
115+
</classpath>
116+
</taskdef>
117+
118+
<target name="svn-revision" >
119+
<svn>
120+
<status path="." revisionProperty="svn.revision" />
121+
</svn>
122+
<echo>Subversion Revision: ${svn.revision}</echo>
123+
</target>
124+
125+
<target name="manifest" depends="svn-revision">
126+
<tstamp/>
127+
<manifest file="MANIFEST.MF">
128+
<attribute name="Title" value="${projectname}"/>
129+
<attribute name="Version" value="${version}.${svn.revision} ${TODAY}"/>
130+
<attribute name="Vendor" value="${vendor}"/>
131+
</manifest>
132+
</target>
133+
134+
<target name="copy-module-resources">
135+
<!-- copy openda resources and additional binaries -->
136+
<copy todir="${modulelibdir}" flatten="yes">
137+
<!-- copy resources -->
138+
<fileset dir="${resourcesdir}">
139+
<include name="**/*.jar"/>
140+
<include name="**/*.dll"/>
141+
<include name="**/*.DLL"/>
142+
<include name="**/*.so"/>
143+
<include name="**/*.lic"/>
144+
<include name="**/*.LIC"/>
145+
<include name="**/*.xsd"/>
146+
<include name="**/*.exe"/>
147+
<include name="**/*.EXE"/>
148+
<include name="**/*.bat"/>
149+
<include name="**/*.BAT"/>
150+
<include name="**/*.test"/>
151+
<include name="**/openDA_castor_schemas.zip"/>
152+
</fileset>
153+
</copy>
154+
<copy todir="${modulebindir}" flatten="yes">
155+
<fileset dir="${external}">
156+
<include name="**/*.sh"/>
157+
<include name="**/*.bat"/>
158+
<include name="**/*.exe"/>
159+
<include name="**/*.pl"/>
160+
<include name="**/*.dll"/>
161+
</fileset>
162+
</copy>
163+
<copy todir="${modulebindir}" flatten="no">
164+
<fileset dir="${native_bin}">
165+
<include name="**/*"/>
166+
<exclude name="**/*.exp"/>
167+
</fileset>
168+
</copy>
169+
<chmod dir="${modulebindir}" perm="ugo+rx" includes="**/*.sh"/>
170+
<chmod dir="${modulebindir}" perm="ugo+rx" includes="**/*.pl"/>
171+
</target>
172+
173+
174+
</project>
175+

java/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

java/resources/Application.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#! /bin/bash
2+
#
3+
# Purpose : startup script for openDA applications
4+
# Args : -gui to start the gui
5+
# -p perform a parallel run
6+
# <file> to open configuration file
7+
# Examples: Application.sh : starts gui
8+
# Application.sh -gui : starts gui
9+
# Application.sh main.xml : starts computations without gui
10+
# Application.sh -gui main.xml : starts gui and opens the configuration file main.xml
11+
# Author : M. verlaan
12+
# License : GPL
13+
14+
# read local settings
15+
if [ -z "$OPENDADIR" ];then
16+
echo "OPENDADIR not set! Run settings_local.sh to fix this"
17+
exit 1;
18+
fi
19+
if [ ! -z "$OPENDALIB" ]; then
20+
echo "setting path for OPENDALIB"
21+
export LD_LIBRARY_PATH=$OPENDALIB:$LD_LIBRARY_PATH
22+
fi
23+
24+
# append all jars in opendabindir to java classpath
25+
for file in $OPENDADIR/*.jar ; do
26+
if [ -f "$file" ] ; then
27+
export CLASSPATH=$CLASSPATH:$file
28+
fi
29+
done
30+
31+
# starting from bin-directory is necessary for *.so loading now TODO fix this
32+
if [ $# -eq 0 ] ; then
33+
java org.openda.application.OpenDaApplication -gui
34+
elif [ $# -eq 1 ]; then
35+
if [ "$1" == "-gui" ]; then
36+
java org.openda.application.OpenDaApplication -gui
37+
else
38+
39+
configFile=$1
40+
if [ ! -f $configFile ]; then
41+
echo "OpenDa config file $configFile not found"
42+
exit 1
43+
fi
44+
45+
logfile="`dirname $configFile`/openda_logfile.txt"
46+
47+
echo "========================================================================="
48+
echo Starting "java org.openda.application.OpenDaApplication $1 > $logfile 2>&1"
49+
50+
# start timing
51+
STARTRUN=`date +%s`
52+
echo "$configFile" > $logfile
53+
date "+%F, %H:%M:%S" >> $logfile 2>&1
54+
55+
# run application
56+
java org.openda.application.OpenDaApplication $configFile > $logfile 2>&1
57+
58+
# end timing
59+
date "+%F, %H:%M:%S" >> $logfile 2>&1
60+
ENDRUN=`date +%s`
61+
declare -i DURATION
62+
DURATION=($ENDRUN-$STARTRUN)
63+
echo DURATION, "$DURATION" >> $logfile 2>&1
64+
65+
echo "Run finished"
66+
echo "========================================================================="
67+
68+
fi
69+
elif [ $# -eq 2 ]; then
70+
if [ "$1" != "-gui" -a "$1" != "-p" ]; then
71+
echo "This scipt accepts no more than one file and option -gui or -p"
72+
exit 1
73+
fi
74+
if [ ! -f $2 ]; then
75+
echo "OpenDa config file $2 not found"
76+
exit 1
77+
fi
78+
java org.openda.application.OpenDaApplication $1 $2
79+
else
80+
echo "This scipt accepts no more than one file and option -gui"
81+
fi
82+

java/resources/MESSAGE.WDM

200 KB
Binary file not shown.

java/resources/ModifyHeaders.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#! /bin/bash
2+
#
3+
# Purpose : startup script for modification of headers
4+
# Args : directory eg '.' [optional with default .]
5+
# suffix eg 'java' [optional with default java]
6+
# Author : M. verlaan
7+
# License : LGPL
8+
9+
# read local settings
10+
if [ -z "$OPENDADIR" ];then
11+
echo "OPENDADIR not set! Run settings_local.sh to fix this"
12+
exit 1;
13+
fi
14+
if [ ! -z "$OPENDALIB" ]; then
15+
echo "setting path for OPENDALIB"
16+
export LD_LIBRARY_PATH=$OPENDALIB:$LD_LIBRARY_PATH
17+
fi
18+
19+
# append all jars in opendabindir to java classpath
20+
for file in $OPENDADIR/*.jar ; do
21+
if [ -f "$file" ] ; then
22+
export CLASSPATH=$CLASSPATH:$file
23+
fi
24+
done
25+
#echo "CLASSPATH = " $CLASSPATH
26+
27+
# starting from bin-directory is necessary for *.so loading now TODO fix this
28+
if [ $# -eq 0 ] ; then
29+
java org.openda.tools.HeaderModifier
30+
elif [ $# -eq 1 ]; then
31+
dirName=$1
32+
echo "========================================================================="
33+
echo Starting "java org.openda.tools.HeaderModifier $dirName"
34+
35+
# run application
36+
java org.openda.tools.HeaderModifier $dirName
37+
38+
echo "========================================================================="
39+
elif [ $# -eq 2 ]; then
40+
dirName=$1
41+
suffix=$2
42+
echo "========================================================================="
43+
echo Starting "java org.openda.tools.HeaderModifier $dirName $suffix"
44+
45+
# run application
46+
java org.openda.tools.HeaderModifier $dirName $suffix
47+
48+
echo "========================================================================="
49+
else
50+
echo "This scipt accepts no more than two arguments"
51+
fi
52+

java/resources/bin_external_to_bin.test

Whitespace-only changes.

0 commit comments

Comments
 (0)