new hydro()
Main class used for hydrological analyses.
Methods
(static) arithmetic(data) → {Object}
Computation of aereal mean precipitation for a river basin given it has 2 or more different stations.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Contains: array object with precipitation with equal amounts of data from different rain gauges. |
Returns:
Array with object with average precipitation for a specific time series.
- Type
- Object
Example
hydro.analyze.hydro.arithmetic({data: [[1, 2, 3, 4], [2, 3, 5, 2]]});
(static) bucketmodel(params, args, data) → {Array.<Object>}
Simple rainfall-runoff analyses over a rainfall dataset given landuse, baseflow and infiltration capacity.It is mainly used for long-term hydrological analysis such as monthly changes. All should be in mm. For more info, refer to https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.544.5085&rep=rep1&type=pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: baseflow, infiltration (in same units) |
args |
Object | Contains: landuse percentage (summing all to 1): agriculture, barerock, grassland, forest, urban |
data |
Array.<Object> | Contains: 2d-JS array in the following order: [[rainfall], [evaporation]] |
Returns:
1d-array with time series according to different time spans (5min, 15 min, 1 hour, 1 day...).
- Type
- Array.<Object>
Example
hydro.analyze.hydro.bucketmode({params:{baseflow: 1, infiltration: 0.3},
args: {agriculture: 0.1, evaporation: 0.2, barerock: 0.5, grassland: 0.1, forest: 0.05, urban: 0.05},
data: [[1,2,3,4,5], [0.1,0.2,0.3,0.4,0.5]})
(static) calculate_tds(params) → {number}
Calculates the total dissolved solids (TDS) based on the sensor reading, temperature, and conductivity factor Reference: https://www.safewater.org/fact-sheets-1/2017/1/23/tds-and-ph
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (sensor reading of dissolved solids), temperature (temperature in Celsius), conductivity_factor (factor for converting conductivity to TDS) |
Returns:
The calculated total dissolved solids (TDS) value.
- Type
- number
Example
const params = {
conductivity_factor: 0.02,
}
const data = {
sensor_reading = [100, 120, 90];
temperature = [28, 26, 25];
}
hydro.analyze.hydro.calculate_tds({ params, data });
(static) calculate_tss(params) → {number}
Calculates the total suspended solids (TSS) based on the sensor reading Reference: https://fyi.extension.wisc.edu/foxdemofarms/the-basics/total-suspended-solids/
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (measurement from the sensor) |
Returns:
The total suspended solids concentration
- Type
- number
Example
hydro.analyze.hydro.calculate_tss({ params: {conversionFact: 0.2}, data: data });
(static) calculateDOSaturation(params) → {number}
Calculates dissolved oxygen (DO) saturation using Henry's Law Reference: https://www.waterboards.ca.gov/water_issues/programs/swamp/docs/cwt/guidance/3110en.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (dissolved oxygen reading from the sensor), temperature (temperature in Celsius). |
Returns:
The dissolved oxygen saturation value.
- Type
- number
Example
const data = {
sensor_reading = [5.2, 4.8, 6.1];
temperature = [25, 26, 24];
}
const params = {
HenryConstant: 0.023,
atmosphericPressure: 1.0,
};
hydro.analyze.hydro.calculateDOSaturation({ params, data });
(static) calculatepH(params) → {number}
Calculate the pH value based on the concentration of hydrogen ions (H+)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters for pH calculation |
Returns:
The pH value
- Type
- number
Example
const params = { hConcentration: 1e-7 };
hydro.analyze.hydro.calculatepH({params})
(static) calculatePrecipitationMinMax(data) → {Object}
Calculates the maximum and minimum precipitation values from the given array of precipitation data
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the precipitation data in the form of an array |
Returns:
An object with 'max' and 'min' properties representing the maximum and minimum precipitation values, respectively
- Type
- Object
Example
const precipitationData = [10, 15, 5, 20, 12];
hydro.analyze.hydro.calculatePrecipitationMinMax({ data: precipitationData });
(static) calibratePH(params) → {number}
Calibrates the pH sensor reading using calibration values Reference:
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (pH reading from the sensor), calibration_values (object with calibration values for slope and intercept). |
Returns:
The calibrated pH value
- Type
- number
Example
hydro.analyze.hydro.calibratePH({
params: {
calibration_values: { slope: 0.9, intercept: 0.2 },
},
data: [sensor_reading_1, sensor_reading_2, sensor_reading_3]
});
(static) compensateORP(params) → {number}
Compensates the oxidation reduction potential (ORP) sensor reading for temperature variations Reference: https://www.gov.nt.ca/ecc/sites/ecc/files/oxidation-reduction_potential.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (ORP sensor reading), temperature (temperature in Celsius). |
Returns:
The compensated ORP value.
- Type
- number
Example
const sensor_reading = [100, 120, 90];
const temperature = [28, 26, 25];
hydro.analyze.hydro.compensateORP({ params: sensor_reading, data: temperature });
(static) convertTemperature(params) → {number}
Converts temperature from one unit to another
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (temperature reading from the sensor), from_unit (unit of the input temperature), to_unit (desired unit for conversion). |
Returns:
The converted temperature value.
- Type
- number
Example
hydro.analyze.hydro.convertTemperature({ params: { sensor_reading: 25, from_unit: 'Celsius', to_unit: 'Fahrenheit' } });
(static) convertTurbidity(params) → {number}
Converts turbidity values from one unit to another Reference: https://www.usgs.gov/special-topics/water-science-school/science/turbidity-and-water
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | sensor_reading (turbidity reading from the sensor), from_unit (current unit of turbidity), to_unit (desired unit of turbidity) |
Throws:
-
if turbidity unit conversion doesnt exist
- Type
- Error
Returns:
The converted turbidity value
- Type
- number
Example
hydro.analyze.hydro.convertTurbidity({ params: { sensor_reading: 50, from_unit: 'NTU', to_unit: 'FTU' } });
(static) darcysLaw(params, args, data) → {number}
Calculate groundwater flow using Darcy's law for unconfined aquifers Reference: https://books.gw-project.org/hydrogeologic-properties-of- earth-materials-and-principles-of-groundwater-flow/chapter/darcys-law/
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | aquifer type (confined, unconfined, dynamic) |
args |
Object | hydraulicConductivity (ability to transmit water in m/s or cm/s), and porosity (fraction of total volume filled with pores, dimensionless/percentage) |
data |
Object | hydraulicGradient (change in hydraulic head per unit distance, dimensionless), aquiferThickness (thickness at a specific location, typically in meters/cm) |
Throws:
-
if the type of aquifer inputted is not a valid choice
- Type
- Error
Returns:
Groundwater flow rate in unconfined aquifers
- Type
- number
Example
const unconfinedParams = {
hydraulicConductivity: 10,
hydraulicGradient: 0.05,
aquiferThickness: 20
};
hydro.analyze.hydro.darceysLawUnconfined({params: unconfinedParams})
(static) dissolvedOxygenDemand(params, data) → {number}
Calculates the dissolved oxygen demand based on the given parameters and data Reference: https://archive.epa.gov/water/archive/web/html/vms52.html
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The parameters required for the calculation |
data |
Object | The relevant data for the calculation |
Returns:
The dissolved oxygen demand
- Type
- number
Example
const params = {temperature: 20, biochemicalOxygenDemand: 5 };
const data = {salinity: 0.5, organicMatter: 10 };
hydro.analyze.hydro.dissolvedOxygenDemand({params, data})
(static) dynamicGround1D(params, args, data) → {Array}
Solves 1D dynamic groundwater simulation using the Crank-Nicolson method Adapted from (Molkentin, 2019)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: length (length of the domain), nodes (number of nodes), k (hydraulic conductivity |
args |
Object | Contains: dt (time step), T (total simulation time), h0 (initial hydraulic head), hL (hydraulic head at the boundary), q0 (flow rate at the boundary), qL (flow rate at the boundary), phi (porosity), Ss (specific storage), Sy (specific yield |
data |
Array | Additional data |
Returns:
Array of solutions representing the hydraulic head at each node
- Type
- Array
Example
hydro.analyze.hydro.dynamicGround1D(
params: { length: 100, nodes: 10, k: 0.5 }
args: { dt: 0.1, T: 10, h0: 10, hL: 5, q0: 1, qL: 0.5, phi: 0.3, Ss: 0.002, Sy: 0.15 }
data: [
});
(static) equationsystemsolver(params, data) → {Array.<Object>}
Solves linear equations in the form Ax = b.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: right (right hand side 1D JS array), left (left hand side 1D JS array) |
data |
Array.<Object> | Contains: matrix to be filled. |
Returns:
Left vector solution.
- Type
- Array.<Object>
Example
hydro.analyze.hydro.equationsystemsolver({params: {left: [data1, data2,...], right: [data1, data2,...]}, data: [[someMatrix]]})
(static) ETBlaneyCriddle(params) → {Array.<Number>}
Calculates evapotranspiration using the Blaney-Criddle method Reference: https://legacy.azdeq.gov/environ/water/permits/download/blaney.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: temperature (mean monthly air temperature in °C), |
Throws:
-
if missing data, data not in array format, unequal length of arrays
- Type
- Error
Returns:
Evapotranspiration in mm/day for each month.
- Type
- Array.<Number>
Example
hydro.analyze.hydro.ETBlaneyCriddle({params: {temperature: [10, 15, 20, ...], monthDays: [31, 28, 31, ...]}})
(static) ETHargreaves(params) → {Number}
Calculates evapotranspiration using the Hargreaves method Reference: https://globalchange.mit.edu/publication/15554#:~:text=The%20Hargreaves %20and%20Modified%20Hargeaves,the%20Modified%20Penman%2DMonteith%20approach.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | temperature (mean daily air temperature in °C), temperatureMax (maximum daily air temperature in °C), temperatureMin (minimum daily air temperature in °C), latitude (latitude in decimal degrees) |
Returns:
Evapotranspiration in mm/day.
- Type
- Number
Example
hydro.analyze.hydro.ETHargreaves({params: {temperature: 25, temperatureMax: 30, temperatureMin: 20, latitude: 40}})
(static) ETPenmanMontheith(params) → {Number}
Calculates evapotranspiration using the Penman-Monteith equation Reference: https://www.fao.org/3/X0490E/x0490e06.htm
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | netRadiation (net radiation in MJ/m^2/day), temperature (air temperature in °C), windSpeed (wind speed at 2m height in m/s), saturationVaporPressure (saturation vapor pressure in kPa), actualVaporPressure (actual vapor pressure in kPa) |
Throws:
-
if missing parameters required for the function
- Type
- Error
Returns:
Evapotranspiration in mm/day
- Type
- Number
Example
hydro.analyze.hydro.ETPenmanMontheith({params: {netRadiation: 10, temperature: 25, windSpeed: 2, saturationVaporPressure: 2,
actualVaporPressure: 1, airPressure: 101.3, psychrometricConstant: 0.065}})
(static) ETPriestelyTaylor(params) → {Number}
Calculates evapotranspiration using the Priestley-Taylor method Reference: https://wetlandscapes.github.io/blog/blog/penman-monteith-and-priestley-taylor/
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains the required parameters of netRadiation and latentHeatFlux in in Watts per square meter (W/m^2) |
Returns:
Evapotranspiration in mm/day
- Type
- Number
Example
hydro.analyze.hydro.ETPriestelyTaylor({params: {netRadiation: 3, latentHeatFlux: 3}})
(static) ETThornthwaite(params) → {Array.<Number>}
Calculates evapotranspiration using the Thornthwaite method Reference: https://wikifire.wsl.ch/tiki-indexf125.html?page=Potential+evapotranspiration#:~:text= The%20Thornthwaite%20equation%20is%20a,Thornthwaite%20%26%20Mather%20(1957).
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: temperature (mean monthly air temperature in °C), latitude (latitude in decimal degrees), monthDays (number of days in each month) |
Throws:
-
if missing required data, invalid data format (not in array), or unequal array length
- Type
- Error
Returns:
Evapotranspiration in mm/day for each month
- Type
- Array.<Number>
Example
hydro.analyze.hydro.ETThornthwaite({params: {temperature: [10, 15, 20, ...], latitude: 40, monthDays: [31, 28, 31, ...]}})
(static) floodhydro(params, args, data) → {Array.<Object>}
Flooding hydrograph generator using a unit hydrograph, precipitation data and SCS metrics for runoff calculation. If the observed hydrograph option is selected, the precipitation must be dividied in blocks of rainfall in as a 2D array [[date, date, date], [rainf, rainf, rainf]]
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: baseflow |
args |
Object | Contains: type (SCS, obs), CN (if SCS), stormduration (event duration in hours), timestep (in hours), units (si, m) |
data |
Array.<Object> | Contains: 2d-JS array with Timeseries Data [[TSrainfall], [TSunithydro]] |
Returns:
Array with values for runoff as time series.
- Type
- Array.<Object>
Example
var floodconfig = {rainfall: 2darray, unithydro: 2darray, type: "obs"};
hydro1.analyze.hydro.floodhydro({params: {baseflow: 'someNum'}, args: {type: 'someType', CN: 'someNum', stormduration: 'someNum', timestep: 'someNum'}
data: [[[1,2,3][0.1,0.2,0.4]], [[1,2,3],[0.3,0.1,0.2]]]})
(static) generateSyntheticValue(params) → {number}
Calculate the pH value based on the concentration of hydrogen ions (H+)
Parameters:
Name | Type | Description |
---|---|---|
params |
number | mean and standard deviation values |
Returns:
The random generated synthetic value
- Type
- number
Example
hydro.analyze.hydro.generateSyntheticValue(10, 10, 'normal')
(static) getJulianDay(date) → {number}
Calculates Julian day from a given date
Parameters:
Name | Type | Description |
---|---|---|
date |
string | Date | The input date as a string in a recognized date format or a Date object |
Throws:
-
If the input date format is invalid
- Type
- Error
Returns:
calculated Julian date
- Type
- number
Example
hydro.analyze.hydro.getJulianDay('2022-01-01')
(static) ground1d(params, args) → {Array.<Object>}
Solves 1d groundwater steady simulation using gaussian elimination for a static setting. Adapted from (Molkentin, 2019).
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: length, k (discharge coeff), nodes |
args |
Object | Contains: w0 and q0 (extraction, discharge at point 0), w1 and q1 (extraction, discharge point 1) |
Returns:
Matrix with solutions.
- Type
- Array.<Object>
Example
hydro.analyze.hydro.groud1d({params: {length: 'someNum', k: 'someNum', nodes: 'someNodes'},
args: {w0: 'someNum', w1: 'someNum', q0: 'someNum', q1: 'someNum'}})
(static) hyetogen(params, data) → {Object}
Hyetograph generator for a uniformly distributed rainfall event. This function generates a hyetograph for a long-duration storm based on a uniformly distributed rainfall event.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: duration (number) representing the duration of the storm in hours, timestep (number) representing the time interval for the hyetograph in hours, and intensity (number) representing the rainfall intensity in mm/hour. |
data |
Object | Contains: event (2D array with timeseries of a rainfall event). |
Returns:
An object containing the hyetograph array and the timestep used to generate it.
- Type
- Object
Example
hydro.analyze.hydro.hyetogen({params: {duration: 24, timestep: 1, intensity: 20}})
hydro.analyze.hydro.hyetogen({data: {event: [[time1, time2, ...], [rainf1, rainf2, ...]]}})
(static) InfGreenAmpt(params) → {Number}
Calculates infiltration using the Green-Ampt model Reference: https://www.hec.usace.army.mil/confluence/rasdocs/ras1dtechref/6.1/ overview-of-optional-capabilities/modeling-precipitation-and-infiltration/green-ampt
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: Ks (saturated hydraulic conductivity [L/T]), psi (soil suction head [L]), theta_i (initial soil moisture content [L^3/L^3]), theta_s (saturated soil moisture content [L^3/L^3]), t (time [T]) |
Throws:
-
invalid data type is inputted
- Type
- Error
Returns:
Infiltration rate [L/T]
- Type
- Number
Example
hydro.analyze.hydro.InfGreenAmpt({params: {Ks: someNum, psi: someNum, theta_i: someNum, theta_s: someNum, t: someNum}})
(static) InfHorton(params) → {Number}
Calculates infiltration using the Horton model Reference: https://www.egr.msu.edu/classes/ce421/lishug/text%20book.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: Ks (saturated hydraulic conductivity [L/T]), fc (field capacity [L^3/L^3]), t (time [T]) |
Throws:
-
invalid data type is inputted
- Type
- Error
Returns:
Infiltration rate [L/T]
- Type
- Number
Example
hydro.analyze.hydro.InfHorton({params: {Ks: someNum, fc: someNum, t: someNum}})
(static) InfKostiakov(params) → {Number}
Calculates infiltration using the Kostiakov model Reference: Kostiakov, A.N. (1932). Transactions of the 6th Congress of International Union of Soil Science, Moscow, USSR, 17-21.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | K (initial infiltration rate [L/T]), C (Kostiakov constant [T^(1/2)/L^(1/2)]), t (time [T]) |
Throws:
-
If the input parameters are not numbers or the time is negative
- Type
- Error
Returns:
Infiltration rate [L/T]
- Type
- Number
Example
hydro.infiltration.infKostiakov({ params: { K: 2, C: 0.3, t: 3 } });
(static) InfPhilip(params) → {Number}
Calculates infiltration using the Philip model Reference: https://www.iuss.org/19th%20WCSS/Symposium/pdf/2266.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: K (hydraulic conductivity [L/T]), S (suction head [L]), t (time [T]) |
Throws:
-
invalid data type is inputted
- Type
- Error
Returns:
Infiltration rate [L/T]
- Type
- Number
Example
hydro.analyze.hydro.InfPhilip({params: {K: someNum, S: someNum, t: someNum}})
(static) InfSmithParlange(params) → {Number}
Calculates infiltration using the Smith-Parlange model Reference: Smith, R.E., Parlange, J.-Y. (1978). Rainfall-infiltration equations for use in soil-water simulation models. Journal of Hydrology, 36(1-2), 1-24.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | K (hydraulic conductivity [L/T]), t (time [T]) |
Throws:
-
If the input parameters are not numbers or the time is negative
- Type
- Error
Returns:
Infiltration rate [L/T]
- Type
- Number
Example
hydro.infiltration.infSmithParlange({ params: { K: 0.2, t: 5 } });
(static) inverseDistanceWeighting(params) → {Array.<Object>}
Disaggregation: Distributes the total rainfall of a larger area to smaller sub-areas based on their relative proportions or weights. Reference: https://journals.ametsoc.org/view/journals/hydr/19/12/jhm-d-18-0132_1.xml
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | totalRainfall (total rainfall of the larger area), weights (array of relative weights/proportions of smaller sub-areas) |
Throws:
-
If totalRainfall, basinAreas, or distances are not numbers or arrays
- Type
- Error
Returns:
Array of rainfall values for each smaller sub-area
- Type
- Array.<Object>
Example
hydro.analyze.hydro.inverseDistanceWeighting({
params: {
totalRainfall: 200,
basinAreas: [10, 20, 15],
distances: [5, 8, 10],
}
});
(static) kinematicWaveRouting(params, data) → {Array.<number>}
Performs single channel routing of a hydrological process using the Kinematic Wave Routing method
- Reference: https://www.engr.colostate.edu/~ramirez/ce_old/classes/cive322-Ramirez/CE322_Web/ExampleKinematicWave.pdf
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | travel time coefficient (C) represents time for water to travel a unit length of channel, Length of the reach (L) represents distance water travels within the channel, Time step (dt) is duration of each time interval |
data |
Object | Input data for the routing |
Returns:
- Array of outflow values at each time step.
- Type
- Array.<number>
Example
const params = {
C: 0.6,
L: 1000,
dt: 1
initialDepth: 0
};
const data = {
inflow: [10, 15, 20, 18, 12],
};
hydro.analyze.hydro.kinematicWaveRouting({ params, data });
(static) lagAndRoute(params, data) → {Array.<number>}
Lag and Route method for flood routing introducing a time delay Reference: https://download.comet.ucar.edu/memory-stick/hydro/ basic_int/routing/navmenu.php_tab_1_page_7.2.0.htm
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | |
data |
Object | lagTime (lag in the system, representing the time it takes for the water to travel through the channel or reservoir) routingCoefficients(control the contribution of inflow at different time intervals) |
Returns:
Outflow data after routing using the Lag and Route method.
- Type
- Array.<number>
Example
const inflowData = [100, 200, 300, 400, 500];
const lagTime = 2;
const routingCoefficients = [0.2, 0.3, 0.5];
hydro.analyze.hydro.lagAndRoute({ params: {lagTime, routingCoefficients} }, data: { inflow: inflowData }});
(static) matrix(params) → {Array.<Object>}
Creates a matrix of m x n dimensions filled with whatever the user requires. For numerical calculations, fill it with 0s.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: m(num columns), n (num rows), d (filler) |
Returns:
Matrix - m x n array.
- Type
- Array.<Object>
Example
hydro.analyze.hydro.matrix({params: {m: someNum, n: someNum, d: someNum}})
(static) move(data, params) → {Array.<Object>}
Moving arrays from one location to another given an index.
Parameters:
Name | Type | Description |
---|---|---|
data |
Array.<Object> | Contains: array that is to be pushed in subtitute array. |
params |
Object | Contains: from (index in original array), to (index in substitute array) |
Returns:
Array with transposed columns
- Type
- Array.<Object>
Example
hydro.analyze.hydro.move({params: {to: 'someNum', from: 'someNum'}, data: [somenD-Array]})
(static) muskingumCunge(params, data) → {Array.<Object>}
Muskingum-Cunge method for flood routing Reference: https://ponce.sdsu.edu/muskingum_cunge_method_explained.html
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Parameters for the Muskingum-Cunge method, K (routing coefficient - determines weight given to previous storage) and X (X coefficient - difference between inflow and outflow rates) |
data |
Array.<Object> | Array of input hydrograph data |
Returns:
Array of routed hydrograph data
- Type
- Array.<Object>
Example
const inflowData = [100, 200, 300, 400, 500];
const initialStorage = 0;
const params = {K: 0.4, X: 0.2, Dt: 1};
hydro.analyze.hydro.muskingumCunge({ params, data: { inflow: inflowData, initialStorage } });
(static) precipitationFrequencyAnalysis(data) → {Array.<Object>}
Performs precipitation frequency analysis and estimates the occurrence probability of different precipitation intensities over the given time duration.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the precipitation data in the form of an array and the time duration. |
Returns:
An array of objects containing precipitation intensity and its occurrence probability.
- Type
- Array.<Object>
Example
const data = {
timeDuration: 24, // 24 hours
precipitationData: [10, 15, 5, 20, 12, 8, 25, 30, 10, 18] // Precipitation data for 24 hours
};
hydro.analyze.hydro.precipitationFrequencyAnalysis({data});
(static) rainaggr(params, data) → {Array.<Object>}
Aggregates or dissaggregates rainfall data depending on what the user requires. The date type must be a Javascript string or number and in minutes or hours, but both the aggregation interval require and the data interval should be the same. For aggregation, the interval for aggregation must be larger than the time step. For example, 15 min or 30 min data to be aggregatted every 60 minutes. Intervals must be multiples of the final aggregaiton (2, 4, etc)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: type (aggr, disagg), interval (in minutes for both cases) |
data |
Array.<Object> | Contains: data as 2D array in |
Returns:
Array with aggregated/disaggregated data.
- Type
- Array.<Object>
Example
hydro1.analyze.hydro.rainaggr({params: {type: 'aggr', interval: 240}, data: [[rainTS]]})
(static) rainfallErosivityIndex(data) → {number}
Calculates the Rainfall Erosivity Index (EI) using the Wischmeier and Smith equation Rainfall Erosivity Index (EI) represents the potential for soil erosion caused by rainfall Reference: https://directives.sc.egov.usda.gov/OpenNonWebContent.aspx?content=29994.wba
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the rainfall intensity and duration data |
Returns:
The calculated Rainfall Erosivity Index (EI)
- Type
- number
Example
const data = {
intensity: [50, 40, 30, 25, 20], // Rainfall intensities (mm/h) for different durations
duration: [0.5, 1, 2, 3, 4], // Corresponding durations (hours)
};
hydro.analyze.hydro.rainfallErosivityIndex({data});
(static) rainfallIntensityDurationFrequency(data) → {Array.<Object>}
Generates Rainfall Intensity-Duration-Frequency (IDF) curves based on an extended period of time precipitation data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the extended period of time precipitation data. |
Returns:
An array of objects containing rainfall intensity, duration, and frequency of occurrence.
- Type
- Array.<Object>
Example
const data = {
precipitationData: [10, 15, 5, 20, 12, 8, 25, 30, 10, 18, ...] // Precipitation data for an extended period of time
};
hydro.analyze.hydro.rainfallIntensityDurationFrequency({data});
(static) rainfallInterceptionModel(data) → {number}
Calculates the rainfall interception loss using a Rainfall Interception Model Rainfall interception is the process by which rainfall is intercepted by vegetation and does not reach the ground
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the rainfall interception model parameters. |
Returns:
The calculated rainfall interception loss (in mm).
- Type
- number
Example
const data = {
totalRainfall: 50,
canopyStorageCapacity: 10,
interceptionCoefficient: 0.3,
};
hydro.analyze.hydro.rainfallInterceptionModel({data});
(static) rainfallThresholdAnalysis(data) → {Array.<Object>}
Performs Rainfall Threshold Analysis to determine the frequency and duration of rainfall events exceeding a specified threshold.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | An object containing the rainfall data and threshold value. |
Returns:
An array of objects containing the duration and frequency of rainfall events exceeding the threshold.
- Type
- Array.<Object>
Example
const data = {
rainfallData: [10, 15, 5, 20, 12, 8, 25, 30, 10, 18, ...], // Rainfall data for an extended period of time
threshold: 15, // Threshold value in mm
};
hydro.analyze.hydro.rainfallThresholdAnalysis({data});
(static) stochasticRainfallGeneration(params) → {Array.<number>}
Generates synthetic rainfall data based on statistical characteristics of observed rainfall Reference: https://cran.r-project.org/web/packages/RGENERATEPREC/vignettes/precipitation_stochastic_generation_v8.html
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains observedRainfall (array of observed rainfall data). |
Throws:
-
If observedRainfall is not provided or not in the correct format.
- Type
- Error
Returns:
Array of synthetic rainfall values generated based on the statistical characteristics.
- Type
- Array.<number>
Example
hydro.analyze.hydro.stochasticRainfallGeneration({
params: {
observedRainfall: [observed_value_1, observed_value_2, observed_value_3]
}
});
(static) syntheticalc(params, args) → {Object}
Calculates parameters for the generation of a unit hydrograph based on SCS method, Snyder Unit Hydrograph. All times of concentrations and lags time are calculated in hours
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: type (SCS, kerby-kirpich, kerby), unit (si, m) |
args |
Object | Contains: l (length), slope (percentage), cn (curve number) |
Returns:
Calculations depending on type.
- Type
- Object
Example
hydro.analyze.hydro.thiessen({params: {type: "SCS",unit: "si"}, args: {L: 4000,slope: 10, cn: 82}})
(static) thiessen(params, args, data) → {Array}
Thiessen polygon method for rainfall areal averaging. Calculates the weighted average of point rainfall observations by dividing the study area into polygonal subareas and weighting each observation by the proportion of the total area it contributes to.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: areas (array with the areas of each polygon) |
args |
Object | Empty for now |
data |
Object | Contains: an array of arrays with rainfall observations for each point |
Returns:
- Array with the weighted average of point rainfall observations for each time step
- Type
- Array
Example
hydro.analyze.thiessen({params: {areas: [10, 20, 30]}data: [[0.3, 0.2, 0.5], [0.2, 0.3, 0.4], [0.1, 0.4, 0.5]]});
(static) timeAreaMethod(params, data) → {Array.<number>}
Calculates the outflow using the Time-Area method for routing Reference: https://www.nohrsc.noaa.gov/technology/gis/uhg_manual.html. #:~:text=The%20time%2Darea%20method%20leads,effective%20rainfall%20duration%20tr
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | inflow (rate of water inflow, can be any consistent flow rate unit such as ft^3/s) and areas (cross-sectional areas of corresponding time intervals in square meters or other area measures) |
data |
Object | Data required for the Time-Area method. |
Throws:
-
If the inflow and areas arrays have different lengths
- Type
- Error
Returns:
Array of outflow values
- Type
- Array.<number>
Example
const inflowData = [100, 200, 300, 400];
const areaData = [1000, 1500, 2000, 2500];
const params = {
intervals: [1, 2, 3, 4]
};
hydro.analyze.hydro.timeAreaMethod({ params, data: { inflow: inflowData, areas: areaData } });
(static) totalprec(data) → {Number}
Arithmetic sum of the values inside an array.
Parameters:
Name | Type | Description |
---|---|---|
data |
Array.<Object> | 1darray with precipitation event. |
Returns:
Total amount of precipitation during an event on a given station.
- Type
- Number
Example
hydro.analyze.hydro.totalprec({data: [some1dArray]})
(static) unithydrocons(params, args, data) → {Array.<Object>}
Unit hydrograph constructor NRCS constructor depending on the physical characteristics of a regularly shaped basin. Adapted from https://directives.sc.egov.usda.gov/OpenNonWebContent.aspx?content=17755.wba
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Contains: drainagearea (in sqmi or km2), type (dim, obs), units(si, m) |
args |
Object | Contains: peak (hours), tconcentration (hours), baseflow (cfs or cumecs) |
data |
Object | Contains: event either dimensionless or observed as 1d-JS array [[TSevent]] |
Returns:
Array with time series array. If metric in m3/s, if SI in cfs.
- Type
- Array.<Object>
Example
hydro.analyze.hydro.unithydrocons({params: {drainagearea: 'someNum', type: 'someNum', units: 'someUnit'}
args: {peak: 'someNum', tconcentration: 'someNum', baseflow: 'someNum'},
data: [[time1, time2, ...], [value1, value2,...]]});