hydroScalingAPI.modules.networkExtraction.objects
Class NetworkExtractionModule

java.lang.Object
  extended by hydroScalingAPI.modules.networkExtraction.objects.NetworkExtractionModule
All Implemented Interfaces:
java.lang.Runnable

public class NetworkExtractionModule
extends java.lang.Object
implements java.lang.Runnable

This class controls the procedures associated to River Network Extraction from DEMs. It comunicates with the GUI and the methods needed to achieve this task

Author:
Jorge Mario Ramirez and Ricardo Mantilla

Field Summary
 float alfa
          The alpha exponent in the Area-Slope based treshold
 boolean archPro
          A flag that indicates if a ROM-based or RAM-based algorithm must be used to calculate the geomorphology
 boolean areaPend_cargar
          Indicates if an existent Area-Slope analysis is to be loaded
 boolean areaPend_LA
          Indicates if an Area-Slope analysis is to be created using blue lines
 boolean areaPend_nuevo
          Indicates if a new Area-Slope analysis is to be created
 float[][] Areas
          An array containing the upstream area for each pixel in the DEM
 float C
          The C coefficient in the Area-Slope based treshold
 float cAltura
          A treshold that indicates a cut in the DEM if more than cAltura meters have to be filled up.
 float cCorte
          A treshold that indicates a cut in the DEM if the filled number of cells is larger than cCorte times the number of cells to cut
 boolean cleanShorts
          A flag that indicates the cleanShortsRoutine will be called
 int colManual
          The column number of the location of the sink that the user wants to modify
 int convergenceAlarmCounter
          The number of times the algorithm fails to converge
 boolean convergenceAlarmType1
          A boolean indicating if the algorithm fails to converge in an area of the DEM
 double[][] DEM
          The DEM under analyisis
 double[][] DEMrep
          An auxiliary matrix used by the RasterNetworkBlueLines module.
 Stats DEMstats
          Statstics associated to the DEM
 int[][] DIR
          The direction matrix associated to the DEM under analysis
 double[] dx
          An array containing the horizontal size of the pixels
 double dxm
          The average horizontal size of the pixel
 double[] dxy
          The diagonal size of the pixels
 double dy
          The vertical size of the pixel
 int filaManual
          The row number of the location of the sink that the user wants to modify
 java.io.File fileLAzules
          The file that contains the blue lines
 GeomorphCell_1[][] GEO
          A matrix of GeomorphCell_1
 GeomorphCell_2[][] GEO2
          A matrix of GeomorphCell_2
 byte[][] LA
          An array used by the RasterNetworkBlueLines to mask the areas where there are blue lines
 boolean laplace
          Indicates the laplace method is to be used to prune the network
 float latManual
          The latitude of the location of the sink that the user wants to modify
 boolean lAzules
          Indicates if a Blue Lines Map is to be used to Guide Network Extraction
 float lonManual
          The longitude of the location of the sink that the user wants to modify
 int maxOrder
          The maximum order of any stream in the DEM
 double[][] MaxPend
          An array containing the maximum slope for each pixel in the DEM
 MetaRaster metaDEM
          The MetaRaster associated with the DEM under analysis
 boolean montgomery
          Indicates the montgomery method is to be used to prune the network
 WorkRectangle MT
          The WorkRectangle represents the area over which the network extraction algorithm is currently working
 int nCeldasConv
          The number of cells that need to converge in order to let a river start
 int npuntosAP
          The number of pixels to use to determine the slope
 ExtractionOptions OpProc
          The GUI used to query the user for tasks to be completed by the NetworkExtractionModule
 int ordenMax
          The Horton order to use as threshold for pruning based on order
 ParentGUI parent
          The main GIS interface
 float pixAP
          A treshold for calculating the Area-Slope analysis
 float pixCManual
          A threshold that indicates when the user wants to intervine in the sink correction algorithm based on the sink's basin size
 float pixManual
          A threshold that indicates when the user wants to intervine in the sink correction algorithm based on the sink size
 float pixPodado
          The area threshold for network pruning
 boolean printDebug
          A boolean stating if the module runs in Debug mode.
 byte[][] RedRas
          An array containing 0s and 1s for each pixel in the DEM.
 java.util.Vector Sink_t
          A Vector contining a list of the sinks in the DEM
 int sinkOrder
          The current sink under analysis
 boolean taskDIR
          Indicates if the user wants to perform the Network extraction algorithm (determines direction matrix)
 boolean taskGEO
          Indicates if the user wants to perform the Geomorphology algorithm
 boolean taskRED
          Indicates if the user wants to perform the Network pruning algorithm
 boolean taskVECT
          Indicates if the user wants to perform the Vectorial network algorithm
 boolean todoRed
          Indicates if all the points should be considered as network
 boolean umbralAP
          Indicates if an Area-Slope analysis is used as threshold
 int unColM
          A flag that indicates if the sink location is given as a longitude or a column number
 int unFilaM
          A flag that indicates if the sink location is given as a latitude or a row number
 int unPixAP
          A flag that indicates if the Area-Slope threshold is given in km^2 or in number of pixels
 int unPixCM
          A flag that indicates if the sink's basin area threshold is given in km^2 or in number of pixels
 int unPixM
          A flag that indicates if the sink area threshold is given in km^2 or in number of pixels
 int unPixPod
          A flag that indicates if the area threshold is given in km^2 or in number of pixels
 
Constructor Summary
NetworkExtractionModule(MetaRaster metaDEM1, DataRaster dataDEM1)
          Creates an instance of the NetworkExtractionModule that uses predetermined tasks to be performed
NetworkExtractionModule(MetaRaster metaDEM1, DataRaster dataDEM1, java.lang.String[] moreArgs)
          Creates an instance of the NetworkExtractionModule that uses the ExtractionOptions interface to query for tasks to be performed
NetworkExtractionModule(ParentGUI parent1, MetaRaster metaDEM1, DataRaster dataDEM1)
          Creates an instance of the NetworkExtractionModule that uses the ExtractionOptions interface to query for tasks to be performed
 
Method Summary
 double calculaIncr(java.util.Vector F)
          Calculates the increment to be applied when the DEM flat area is being filled
 void corrigeDEM()
          The DEM correction algorithm
 void corrigeSink_t()
          Loops through all the sinks in the DEM and fixes them
 void corrigeUniPitFullDEM()
          Runs the uniPit algorithm for the entire DEM
 int get_nextPit()
          Gets the next pit to be fixed
 void inicio(DataRaster dataDEM)
          Initializes the algorithm parameters
 void leeDEM_DIR_AREA_PEND()
          Reads the DEM, direction matrix and upstream area files
 void leeDEM()
          Reads the original DEM
 void leeRED()
          Reads the raster netowrk file
static void main(java.lang.String[] Arguments)
          Various tests for the class
 void run()
          The run method
 void writeCorrDem(java.io.File arch)
          Writes the .corrDEM file
 void writeGEO(java.io.File arch)
          Writes the .redRas, .ltc, .lcp, .horton, .magn, .dtopo, .tcd, and .mcd files
 void writePREL(java.io.File arch)
          Writes the .areas, .corrDEM, .slope, an .dir files
 void writeRED(java.io.File arch)
          Writes the .redRas file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metaDEM

public MetaRaster metaDEM
The MetaRaster associated with the DEM under analysis


DEM

public double[][] DEM
The DEM under analyisis


DEMrep

public double[][] DEMrep
An auxiliary matrix used by the RasterNetworkBlueLines module.


DIR

public int[][] DIR
The direction matrix associated to the DEM under analysis


dy

public double dy
The vertical size of the pixel


dxm

public double dxm
The average horizontal size of the pixel


dx

public double[] dx
An array containing the horizontal size of the pixels


dxy

public double[] dxy
The diagonal size of the pixels


MT

public WorkRectangle MT
The WorkRectangle represents the area over which the network extraction algorithm is currently working


Sink_t

public java.util.Vector Sink_t
A Vector contining a list of the sinks in the DEM


sinkOrder

public int sinkOrder
The current sink under analysis


maxOrder

public int maxOrder
The maximum order of any stream in the DEM


OpProc

public ExtractionOptions OpProc
The GUI used to query the user for tasks to be completed by the NetworkExtractionModule


parent

public ParentGUI parent
The main GIS interface


Areas

public float[][] Areas
An array containing the upstream area for each pixel in the DEM


MaxPend

public double[][] MaxPend
An array containing the maximum slope for each pixel in the DEM


RedRas

public byte[][] RedRas
An array containing 0s and 1s for each pixel in the DEM. Each position determines if there is a channel inside the pixel


LA

public byte[][] LA
An array used by the RasterNetworkBlueLines to mask the areas where there are blue lines


GEO

public GeomorphCell_1[][] GEO
A matrix of GeomorphCell_1


GEO2

public GeomorphCell_2[][] GEO2
A matrix of GeomorphCell_2


convergenceAlarmType1

public boolean convergenceAlarmType1
A boolean indicating if the algorithm fails to converge in an area of the DEM


convergenceAlarmCounter

public int convergenceAlarmCounter
The number of times the algorithm fails to converge


cCorte

public float cCorte
A treshold that indicates a cut in the DEM if the filled number of cells is larger than cCorte times the number of cells to cut


cAltura

public float cAltura
A treshold that indicates a cut in the DEM if more than cAltura meters have to be filled up.


pixManual

public float pixManual
A threshold that indicates when the user wants to intervine in the sink correction algorithm based on the sink size


pixCManual

public float pixCManual
A threshold that indicates when the user wants to intervine in the sink correction algorithm based on the sink's basin size


latManual

public float latManual
The latitude of the location of the sink that the user wants to modify


lonManual

public float lonManual
The longitude of the location of the sink that the user wants to modify


pixPodado

public float pixPodado
The area threshold for network pruning


alfa

public float alfa
The alpha exponent in the Area-Slope based treshold


C

public float C
The C coefficient in the Area-Slope based treshold


pixAP

public float pixAP
A treshold for calculating the Area-Slope analysis


unPixM

public int unPixM
A flag that indicates if the sink area threshold is given in km^2 or in number of pixels


unPixCM

public int unPixCM
A flag that indicates if the sink's basin area threshold is given in km^2 or in number of pixels


unFilaM

public int unFilaM
A flag that indicates if the sink location is given as a latitude or a row number


unColM

public int unColM
A flag that indicates if the sink location is given as a longitude or a column number


filaManual

public int filaManual
The row number of the location of the sink that the user wants to modify


colManual

public int colManual
The column number of the location of the sink that the user wants to modify


ordenMax

public int ordenMax
The Horton order to use as threshold for pruning based on order


unPixPod

public int unPixPod
A flag that indicates if the area threshold is given in km^2 or in number of pixels


unPixAP

public int unPixAP
A flag that indicates if the Area-Slope threshold is given in km^2 or in number of pixels


npuntosAP

public int npuntosAP
The number of pixels to use to determine the slope


nCeldasConv

public int nCeldasConv
The number of cells that need to converge in order to let a river start


cleanShorts

public boolean cleanShorts
A flag that indicates the cleanShortsRoutine will be called


archPro

public boolean archPro
A flag that indicates if a ROM-based or RAM-based algorithm must be used to calculate the geomorphology


lAzules

public boolean lAzules
Indicates if a Blue Lines Map is to be used to Guide Network Extraction


areaPend_nuevo

public boolean areaPend_nuevo
Indicates if a new Area-Slope analysis is to be created


areaPend_cargar

public boolean areaPend_cargar
Indicates if an existent Area-Slope analysis is to be loaded


areaPend_LA

public boolean areaPend_LA
Indicates if an Area-Slope analysis is to be created using blue lines


montgomery

public boolean montgomery
Indicates the montgomery method is to be used to prune the network


laplace

public boolean laplace
Indicates the laplace method is to be used to prune the network


todoRed

public boolean todoRed
Indicates if all the points should be considered as network


umbralAP

public boolean umbralAP
Indicates if an Area-Slope analysis is used as threshold


printDebug

public boolean printDebug
A boolean stating if the module runs in Debug mode. It forces the program to print additional output


taskDIR

public boolean taskDIR
Indicates if the user wants to perform the Network extraction algorithm (determines direction matrix)


taskRED

public boolean taskRED
Indicates if the user wants to perform the Network pruning algorithm


taskGEO

public boolean taskGEO
Indicates if the user wants to perform the Geomorphology algorithm


taskVECT

public boolean taskVECT
Indicates if the user wants to perform the Vectorial network algorithm


fileLAzules

public java.io.File fileLAzules
The file that contains the blue lines


DEMstats

public Stats DEMstats
Statstics associated to the DEM

Constructor Detail

NetworkExtractionModule

public NetworkExtractionModule(MetaRaster metaDEM1,
                               DataRaster dataDEM1,
                               java.lang.String[] moreArgs)
Creates an instance of the NetworkExtractionModule that uses the ExtractionOptions interface to query for tasks to be performed

Parameters:
metaDEM1 - The MetaRaster associated to the DEM to be processed
dataDEM1 - The DataRaster associated to the data
moreArgs - A String[] of arguments that Matt Luck created

NetworkExtractionModule

public NetworkExtractionModule(ParentGUI parent1,
                               MetaRaster metaDEM1,
                               DataRaster dataDEM1)
Creates an instance of the NetworkExtractionModule that uses the ExtractionOptions interface to query for tasks to be performed

Parameters:
parent1 - The main GIS interface
metaDEM1 - The MetaRaster associated to the DEM to be processed
dataDEM1 - The DataRaster associated to the data

NetworkExtractionModule

public NetworkExtractionModule(MetaRaster metaDEM1,
                               DataRaster dataDEM1)
Creates an instance of the NetworkExtractionModule that uses predetermined tasks to be performed

Parameters:
metaDEM1 - The MetaRaster associated to the DEM to be processed
dataDEM1 - The DataRaster associated to the data
Method Detail

inicio

public void inicio(DataRaster dataDEM)
Initializes the algorithm parameters

Parameters:
dataDEM - The DataRaster associated to the data

corrigeDEM

public void corrigeDEM()
The DEM correction algorithm


corrigeSink_t

public void corrigeSink_t()
Loops through all the sinks in the DEM and fixes them


get_nextPit

public int get_nextPit()
Gets the next pit to be fixed

Returns:
The sink to be fixed

corrigeUniPitFullDEM

public void corrigeUniPitFullDEM()
Runs the uniPit algorithm for the entire DEM


calculaIncr

public double calculaIncr(java.util.Vector F)
Calculates the increment to be applied when the DEM flat area is being filled

Parameters:
F - A Vector with the flat areas
Returns:
The value of the increment

writePREL

public void writePREL(java.io.File arch)
Writes the .areas, .corrDEM, .slope, an .dir files

Parameters:
arch - The path where the files will be stored

writeCorrDem

public void writeCorrDem(java.io.File arch)
Writes the .corrDEM file

Parameters:
arch - The path where the files will be stored

writeRED

public void writeRED(java.io.File arch)
Writes the .redRas file

Parameters:
arch - The path where the files will be stored

writeGEO

public void writeGEO(java.io.File arch)
Writes the .redRas, .ltc, .lcp, .horton, .magn, .dtopo, .tcd, and .mcd files

Parameters:
arch - The path where the files will be stored

leeDEM_DIR_AREA_PEND

public void leeDEM_DIR_AREA_PEND()
Reads the DEM, direction matrix and upstream area files


leeRED

public void leeRED()
Reads the raster netowrk file


leeDEM

public void leeDEM()
Reads the original DEM


run

public void run()
The run method

Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] Arguments)
Various tests for the class

Parameters:
Arguments - The command line arguments


CUENCAS was initially developed by Ricardo Mantilla at the University of Colorado under the supervision of Dr. Vijay K. Gupta. We wish to recognize the support from the National Science Fundation.