Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions model_hec_hms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This model updates the initial states of the HEC HMS model using data assimilation.
Empty file.
154 changes: 154 additions & 0 deletions model_hec_hms/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<project xmlns:if="ant:if" name="openDA" default="help" basedir=".">
<!--
================================================================================
Ant build file for openda java code
install ant and type
"ant help"
for a list of options
================================================================================
-->
<target name="help">
<echo>
ant help --> print this help
ant build --> compile, make jar and copy resources
ant build-test --> compile test classes
ant clean --> remove output
ant javadoc --> build javadoc
</echo>
</target>

<property file="module.properties"/>
<property file="../version.properties"/>

<target name="debug">
<echo>
module=${module}
srcdir=${srcdir}
jarname=${jarname}
builddir=${builddir}
bindir=${bindir}
</echo>
</target>

<!--
===========================================================================
Compilation
===========================================================================
-->
<target name="build" depends="jarfile"/>

<target name="build-test" depends="init">
<javac srcdir="${testdir}" destdir="${buildtestdir}" debug="${debug}" source="${source}" encoding="UTF-8" failonerror="${failonerror}" listfiles="${listfiles}" fork="yes"
memoryInitialSize="${minmemory}" memoryMaximumSize="${maxmemory}" includeantruntime="false">
<classpath>
<fileset dir="${projectdir}">
<include name="${projectlib}/*.jar"/>
</fileset>
</classpath>
</javac>
</target>

<target name="jarfile" depends="moduleclasses,manifest">
<jar jarfile="${modulelibdir}/${jarname}" manifest="MANIFEST.MF">
<fileset dir="${builddir}">
<include name="**/*.class"/>
<include name="**/*.gif"/>
</fileset>
</jar>
</target>

<target name="moduleclasses" depends="init,copy-module-resources">
<javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}" source="${source}" encoding="UTF-8" failonerror="${failonerror}" listfiles="${listfiles}" fork="yes"
memoryInitialSize="${minmemory}" memoryMaximumSize="${maxmemory}" includeantruntime="false" errorProperty="build.errors">
<classpath>
<fileset dir=".">
<include name="${modulelibdir}/*.jar"/>
</fileset>
<fileset dir="${projectdir}">
<include name="${projectlib}/*.jar"/>
</fileset>
</classpath>
</javac>
<echo file="${projectdir}/build.errors" append="true" if:set="build.errors">${module}${line.separator}</echo>
</target>

<target name="javadoc" depends="init">
<javadoc destdir="${javadocdir}/${module}" classpath="${projectfiles}" verbose="yes" windowtitle="openDA.Module: ${module} Version: ${version}" source="${source}">
<fileset dir="${srcdir}">
<include name="**/*.java"/>
</fileset>
</javadoc>
</target>

<!--
===========================================================================
Tools: init, clean, etc.
===========================================================================
-->
<target name="init" depends="clean">
<tstamp/>
<mkdir dir="${builddir}"/>
<mkdir dir="${buildtestdir}"/>
<mkdir dir="${modulebindir}"/>
<mkdir dir="${modulelibdir}"/>
<mkdir dir="${javadocdir}"/>
</target>

<target name="clean">
<delete dir="${modulebindir}"/>
<delete dir="${modulelibdir}"/>
<delete dir="${builddir}"/>
<delete dir="${buildtestdir}"/>
<delete dir="${javadocdir}"/>
<delete file="MANIFEST.MF"/>
</target>

<taskdef resource="org/tigris/subversion/svnant/svnantlib.xml">
<classpath>
<fileset dir="../core/java/resources/svnant-1.3.0/lib" includes="**/*.jar"/>
</classpath>
</taskdef>

<target name="svn-revision">
<svn>
<status path="." revisionProperty="svn.revision"/>
</svn>
<echo>Subversion Revision: ${svn.revision}</echo>
</target>

<target name="manifest" depends="svn-revision">
<tstamp/>
<manifest file="MANIFEST.MF">
<attribute name="Title" value="${projectname}"/>
<attribute name="Version" value="${version}.${svn.revision} ${TODAY}"/>
<attribute name="Vendor" value="${vendor}"/>
</manifest>
</target>

<target name="copy-module-resources">
<!-- copy openda resources and additional binaries -->
<copy todir="${modulelibdir}" flatten="yes">
<!-- copy resources -->
<fileset dir="${resourcesdir}">
<include name="**/*.jar"/>
<include name="**/*.dll"/>
<include name="**/*.DLL"/>
<include name="**/*.so"/>
<include name="**/*.lic"/>
<include name="**/*.LIC"/>
<include name="**/*.xsd"/>
<include name="**/*.exe"/>
<include name="**/*.EXE"/>
<include name="**/*.bat"/>
<include name="**/*.BAT"/>
<include name="**/*.test"/>
</fileset>
</copy>
<copy todir="${modulebindir}" flatten="yes">
<fileset dir="${external}">
<include name="**/*"/>
</fileset>
</copy>
<chmod dir="${modulebindir}" perm="ugo+rx" includes="**/*.sh"/>
</target>
</project>
Empty file added model_hec_hms/doc/.gitkeep
Empty file.
Empty file.
42 changes: 42 additions & 0 deletions model_hec_hms/java/src/org/openda/model_hec_hms/GridBounds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.openda.model_hec_hms;

public class GridBounds {
private int minimumX = Integer.MAX_VALUE;
private int minimumY = Integer.MAX_VALUE;
private int maximumX = Integer.MIN_VALUE;
private int maximumY = Integer.MIN_VALUE;

public void addCell(int x, int y) {
minimumX = Math.min(minimumX, x);
minimumY = Math.min(minimumY, y);
maximumX = Math.max(maximumX, x);
maximumY = Math.max(maximumY, y);
}

public int getX() {
return minimumX;
}

public int getY() {
return minimumY;
}

public int getWidth() {
return maximumX + 1 - minimumX;
}

public int getHeight() {
return maximumY + 1 - minimumY;
}

public int getSize() {
return getWidth() * getHeight();
}

public int getIndex(GridCell gridCell) {
int x = gridCell.getX() - minimumX;
int y = gridCell.getY() - minimumY;

return x * getHeight() + y;
}
}
37 changes: 37 additions & 0 deletions model_hec_hms/java/src/org/openda/model_hec_hms/GridCell.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.openda.model_hec_hms;

import java.util.Objects;

public class GridCell {
private final int x;
private final int y;

public GridCell(int x, int y) {
this.x = x;
this.y = y;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

@Override
public boolean equals(Object other) {
if (!(other instanceof GridCell)) {
return false;
}

GridCell otherGridCell = (GridCell) other;

return x == otherGridCell.x && y == otherGridCell.y;
}

@Override
public int hashCode() {
return Objects.hash(x, y);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.openda.model_hec_hms;

public class GridIdToGridCell {
private final String gridId;
private final GridCell gridCell;

public GridIdToGridCell(String gridId, GridCell gridCell) {
this.gridId = gridId;
this.gridCell = gridCell;
}

public String getGridId() {
return gridId;
}

public GridCell getGridCell() {
return gridCell;
}
}
Loading
Loading