hydrological_modules package

Initialize

miscInitial module

Initializing some variables

class cwatm.hydrological_modules.miscInitial.miscInitial(model)[source]

Bases: object

Miscellaneous repeatedly used expressions Definition if cell area comes from regular grid e.g. 5x5km or from irregular lat/lon Conversion factors between m3 and mm etc.

Note

Only used in the initial phase.

Global variables

Variable [self.var]

Description

Unit

DtSec

number of seconds per timestep (default = 86400)

s

twothird

2/3

MtoM3

Coefficient to change units

InvDtSec

cellArea

Area of cell

m2

InvCellArea

Inverse of cell area of each simulated mesh

m-1

DtDay

seconds in a timestep (default=86400)

s

InvDtDay

inverse seconds in a timestep (default=86400)

s-1

MMtoM

Coefficient to change units

MtoMM

Coefficient to change units

M3toM

Coefficient to change units

con_precipitation

conversion factor for precipitation

con_e

conversion factor for evaporation

Functions

initial()[source]

Initialization of some basic parameters e.g. cellArea

  • grid area, length definition

  • conversion factors

  • conversion factors for precipitation and pot evaporation

initcondition module

Load initial storage parameter maps

class cwatm.hydrological_modules.initcondition.initcondition(model)[source]

Bases: object

READ/WRITE INITIAL CONDITIONS all initial condition can be stored at the end of a run to be used as a warm start for a following up run

Global variables

Variable [self.var]

Description

Unit

includeCrops

1=includeCrops option in settings file is True, 0=otherwise

Crops

Internal: List of specific crops and Kc/Ky parameters

Crops_names

Internal: List of specific crops

loadInit

Flag: if true initial conditions are loaded

initLoadFile

load file name of the initial condition data

saveInit

Flag: if true initial conditions are saved

saveInitFile

save file name of the initial condition data

coverTypes

land cover types - forest - grassland - irrPaddy - irrNonPaddy - water - sealed

Functions

crops_initialise(xl_settings_file_path)[source]
dynamic()[source]

Dynamic part of the initcondition module write initital conditions into a single netcdf file

Note

Several dates can be stored in different netcdf files

initial()[source]
initial part of the initcondition module

Puts all the variables which has to be stored in 2 lists:

  • initCondVar: the name of the variable in the init netcdf file

  • initCondVarValue: the variable as it can be read with the ‘eval’ command

Reads the parameter save_initial and save_initial to know if to save or load initial values

landcoverType module

Generate landcover types

cwatm.hydrological_modules.landcoverType.decompress(map, nanvalue=None)[source]

Decompressing CWatM maps from 1D to 2D with missing values

Parameters

map – compressed map

Returns

decompressed 2D map

class cwatm.hydrological_modules.landcoverType.landcoverType(model)[source]

Bases: object

LAND COVER TYPE

runs the 6 land cover types through soil procedures

This routine calls the soil routine for each land cover type

Global variables

Variable [self.var]

Description

Unit

load_initial

sum_gwRecharge

groundwater recharge

m

modflow

Flag: True if modflow_coupling = True in settings file

modflow_timestep

Chosen ModFlow model timestep (1day, 7days, 30days, etc.)

sumed_sum_gwRecharge

GWVolumeVariation

snowEvap

total evaporation from snow for a snow layers

m

maxGWCapRise

influence of capillary rise above groundwater level

m

minInterceptCap

Maximum interception read from file for forest and grassland land cover

m

interceptStor

simulated vegetation interception storage

m

dynamicLandcover

staticLandCoverMaps

1=staticLandCoverMaps in settings file is True, 0=otherwise

landcoverSum

irrigatedArea_origin

sum_interceptStor

Total of simulated vegetation interception storage including all landcover types

m

minCropKC

minimum crop factor (default 0.2)

minTopWaterLayer

rootFraction1

maxRootDepth

rootDepth

KSat1

KSat2

KSat3

alpha1

alpha2

alpha3

lambda1

lambda2

lambda3

thetas1

thetas2

thetas3

thetar1

thetar2

thetar3

genuM1

genuM2

genuM3

genuInvM1

genuInvM2

genuInvM3

genuInvN1

genuInvN2

genuInvN3

ws1

Maximum storage capacity in layer 1

m

ws2

Maximum storage capacity in layer 2

m

ws3

Maximum storage capacity in layer 3

m

wres1

Residual storage capacity in layer 1

m

wres2

Residual storage capacity in layer 2

m

wres3

Residual storage capacity in layer 3

m

wrange1

wrange2

wrange3

wfc1

Soil moisture at field capacity in layer 1

wfc2

Soil moisture at field capacity in layer 2

wfc3

Soil moisture at field capacity in layer 3

wwp1

Soil moisture at wilting point in layer 1

wwp2

Soil moisture at wilting point in layer 2

wwp3

Soil moisture at wilting point in layer 3

kUnSat3FC

kunSatFC12

kunSatFC23

cropCoefficientNC_fi

interceptCapNC_filen

coverFractionNC_file

sum_topwater

quantity of water on the soil (flooding) (weighted sum for all landcover types)

m

sum_soil

sum_w1

sum_w2

sum_w3

totalSto

Total soil,snow and vegetation storage for each cell including all landcover typ

m

arnoBetaOro

chosen ModFlow model timestep (1day, 7days, 30days, etc.)

arnoBeta

adjRoot

maxtopwater

maximum heigth of topwater

m

totAvlWater

presumed_sum_gwRecha

Previous groundwater recharge [m/timestep] (used for the ModFlow version)

m

pretotalSto

Previous totalSto

m

sum_actBareSoilEvap

sum_openWaterEvap

sum_runoff

Runoff above the soil, more interflow, including all landcover types

m

sum_directRunoff

sum_interflow

sum_availWaterInfilt

sum_capRiseFromGW

capillar rise from groundwater to 3rd soil layer (summed up for all land cover c

m

sum_act_irrConsumpti

sum_perc3toGW

percolation from 3rd soil layer to groundwater (summed up for all land cover cla

m

sum_prefFlow

preferential flow from soil to groundwater (summed up for all land cover classes

m

cellArea

Area of cell

m2

baseflow

simulated baseflow (= groundwater discharge to river)

m

Precipitation

Precipitation (input for the model)

m

coverTypes

land cover types - forest - grassland - irrPaddy - irrNonPaddy - water - sealed

Rain

Precipitation less snow

m

SnowMelt

total snow melt from all layers

m

SnowCover

snow cover (sum over all layers)

m

ElevationStD

prevSnowCover

snow cover of previous day (only for water balance)

m

soilLayers

Number of soil layers

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

soildepth

Thickness of the first soil layer

m

soildepth12

Total thickness of layer 2 and 3

m

w1

Simulated water storage in the layer 1

m

w2

Simulated water storage in the layer 2

m

w3

Simulated water storage in the layer 3

m

topwater

quantity of water above the soil (flooding)

m

act_SurfaceWaterAbst

addtoevapotrans

act_irrWithdrawal

act_nonIrrConsumptio

returnFlow

totalET

Total evapotranspiration for each cell including all landcover types

m

sum_actTransTotal

sum_interceptEvap

Functions

dynamic()[source]

Dynamic part of the land cover type module

Calculating soil for each of the 6 land cover class

  • calls evaporation_module.dynamic

  • calls interception_module.dynamic

  • calls soil_module.dynamic

  • calls sealed_water_module.dynamic

And sums every thing up depending on the land cover type fraction

dynamic_fracIrrigation(init=False, dynamic=True)[source]

Dynamic part of the land cover type module

Calculating fraction of land cover

  • loads the fraction of landcover for each year from netcdf maps

  • calculate the fraction of 6 land cover types based on the maps

Parameters
  • init – (optional) True: set for the first time of a run

  • dynamic – used in the dynmic run not in the initial phase

Returns

initial()[source]

Initial part of the land cover type module Initialise the six land cover types

  • Forest No.0

  • Grasland/non irrigated land No.1

  • Paddy irrigation No.2

  • non-Paddy irrigation No.3

  • Sealed area No.4

  • Water covered area No.5

And initialize the soil variables

Hydrology I - from rain to soil

readmeteo module

Read meteorological input data

class cwatm.hydrological_modules.readmeteo.readmeteo(model)[source]

Bases: object

READ METEOROLOGICAL DATA

reads all meteorological data from netcdf4 files

Global variables

Variable [self.var]

Description

Unit

modflow

Flag: True if modflow_coupling = True in settings file

modflowsteady

True if modflow_steadystate = True in settings file

DtDay

seconds in a timestep (default=86400)

s

con_precipitation

conversion factor for precipitation

con_e

conversion factor for evaporation

TMin

minimum air temperature

K

TMax

maximum air temperature

K

Psurf

Instantaneous surface pressure

Pa

Qair

specific humidity

kg/kg

Tavg

average air Temperature (input for the model)

K

Rsdl

long wave downward surface radiation fluxes

W/m2

Rsds

short wave downward surface radiation fluxes

W/m2

Wind

wind speed

m/s

ETRef

potential evapotranspiration rate from reference crop

m

EWRef

potential evaporation rate from water surface

m

Precipitation

Precipitation (input for the model)

m

meteomapsscale

if meteo maps have the same extend as the other spatial static maps -> meteomaps

meteodown

if meteo maps should be downscaled

preMaps

choose between steady state precipitation maps for steady state modflow or norma

tempMaps

choose between steady state temperature maps for steady state modflow or normal

evaTMaps

choose between steady state ETP water maps for steady state modflow or normal ma

eva0Maps

choose between steady state ETP reference maps for steady state modflow or norma

wc2_tavg

High resolution WorldClim map for average temperature

K

wc4_tavg

upscaled to low resolution WorldClim map for average temperature

K

wc2_tmin

High resolution WorldClim map for min temperature

K

wc4_tmin

upscaled to low resolution WorldClim map for min temperature

K

wc2_tmax

High resolution WorldClim map for max temperature

K

wc4_tmax

upscaled to low resolution WorldClim map for max temperature

K

wc2_prec

High resolution WorldClim map for precipitation

m

wc4_prec

upscaled to low resolution WorldClim map for precipitation

m

prec

precipitation in m

m

temp

average temperature in Celsius deg

Celcius d

WtoMJ

Conversion factor from [W] to [MJ] for radiation: 86400 * 1E-6

Functions

downscaling2(input, downscaleName='', wc2=0, wc4=0, downscale=0)[source]

Downscaling based on Delta method:

Parameters
  • input – low input map

  • downscaleName – High resolution monthly map from WorldClim

  • wc2 – High resolution WorldClim map

  • wc4 – upscaled to low resolution

  • downscale – 0 for no change, 1: for temperature , 2 for pprecipitation, 3 for psurf

Returns

input - downscaled input data

Returns

wc2

Returns

wc4

dynamic()[source]

Dynamic part of the readmeteo module

Read meteo input maps from netcdf files

Note

If option calc_evaporation is False only precipitation, avg. temp., and 2 evaporation vlaues are read Otherwise all the variable needed for Penman-Monteith

Note

If option TemperatureInKelvin = True temperature is assumed to be Kelvin instead of Celsius!

initial()[source]

Initial part of meteo

read multiple file of input

inflow module

Read river discharge time series as inflow data

class cwatm.hydrological_modules.inflow.inflow(model)[source]

Bases: object

READ INFLOW HYDROGRAPHS (OPTIONAL) If option “inflow” is set to 1 the inflow hydrograph code is used otherwise dummy code is used

Global variables

Variable [self.var]

Description

Unit

sampleInflow

location of inflow point

lat/lon

noinflowpoints

number of inflow points

inflowTs

inflow time series data

m3/s

totalQInM3

total inflow over time (for mass balance calculation)

m3

inflowM3

inflow to basin

m3

DtSec

number of seconds per timestep (default = 86400)

s

QInM3Old

Inflow from previous day

m3

Functions

dynamic()[source]

Dynamic part of the inflow module Use the inflow points to add inflow from time series file(s)

initial()[source]

Initial part of the inflow module Get the inflow points

calls function hydrological_modules.getlocOutpoints() calls function hydrological_modules.join_struct_arrays2()

snow_frost module

Calculate snow and frost

class cwatm.hydrological_modules.snow_frost.snow_frost(model)[source]

Bases: object

RAIN AND SNOW

Domain: snow calculations evaluated for center points of up to 7 sub-pixel snow zones 1 -7 which each occupy a part of the pixel surface

Variables snow and rain at end of this module are the pixel-average snowfall and rain

Global variables

Variable [self.var]

Description

Unit

load_initial

DtDay

seconds in a timestep (default=86400)

s

Tavg

average air Temperature (input for the model)

K

Precipitation

Precipitation (input for the model)

m

Rain

Precipitation less snow

m

SnowMelt

total snow melt from all layers

m

SnowCover

snow cover (sum over all layers)

m

ElevationStD

prevSnowCover

snow cover of previous day (only for water balance)

m

numberSnowLayersFloa

numberSnowLayers

Number of snow layers (up to 10)

glaciertransportZone

Number of layers which can be mimiced as glacier transport zone

deltaInvNorm

Quantile of the normal distribution (for different numbers of snow layers)

DeltaTSnow

Temperature lapse rate x std. deviation of elevation

Celcius d

SnowDayDegrees

day of the year to degrees: 360/365.25 = 0.9856

summerSeasonStart

day when summer season starts = 165

IceDayDegrees

days of summer (15th June-15th Sept.) to degree: 180/(259-165)

SnowSeason

seasonal melt factor

m (Celciu

TempSnow

Average temperature at which snow melts

Celcius d

SnowFactor

Multiplier applied to precipitation that falls as snow

SnowMeltCoef

Snow melt coefficient - default: 0.004

IceMeltCoef

Ice melt coefficnet - default 0.007

TempMelt

Average temperature at which snow melts

Celcius d

SnowCoverS

snow cover for each layer

m

Kfrost

Snow depth reduction coefficient, (HH, p. 7.28)

m-1

Afrost

Daily decay coefficient, (Handbook of Hydrology, p. 7.28)

FrostIndexThreshold

Degree Days Frost Threshold (stops infiltration, percolation and capillary rise)

SnowWaterEquivalent

Snow water equivalent, (based on snow density of 450 kg/m3) (e.g. Tarboton and L

FrostIndex

FrostIndex - Molnau and Bissel (1983), A Continuous Frozen Ground Index for Floo

extfrostindex

Flag for second frostindex

FrostIndexThreshold2

FrostIndex2 - Molnau and Bissel (1983), A Continuous Frozen Ground Index for Flo

frostInd1

forstindex 1

frostInd2

frostindex 2

frostindexS

array for frostindex

Snow

Snow (equal to a part of Precipitation)

m

Functions

dynamic()[source]

Dynamic part of the snow module

Distinguish between rain/snow and calculates snow melt and glacier melt The equation is a modification of:

References

Speers, D.D., Versteeg, J.D. (1979) Runoff forecasting for reservoir operations - the pastand the future. In: Proceedings 52nd Western Snow Conference, 149-156

Frost index in soil [degree days] based on:

References

Molnau and Bissel (1983, A Continuous Frozen Ground Index for Flood Forecasting. In: Maidment, Handbook of Hydrology, p. 7.28, 7.55)

Todo

calculate sinus shape function for the southern hemisspere

initial()[source]

Initial part of the snow and frost module

  • loads all the parameters for the day-degree approach for rain, snow and snowmelt

  • loads the parameter for frost

evaporationPot module

Calculate potential Evaporation

class cwatm.hydrological_modules.evaporationPot.evaporationPot(model)[source]

Bases: object

POTENTIAL REFERENCE EVAPO(TRANSPI)RATION Calculate potential evapotranspiration from climate data mainly based on FAO 56 and LISVAP Based on Penman Monteith

References

http://www.fao.org/docrep/X0490E/x0490e08.htm#penman%20monteith%20equation http://www.fao.org/docrep/X0490E/x0490e06.htm http://www.fao.org/docrep/X0490E/x0490e06.htm https://ec.europa.eu/jrc/en/publication/eur-scientific-and-technical-research-reports/lisvap-evaporation-pre-processor-lisflood-water-balance-and-flood-simulation-model

Global variables

Variable [self.var]

Description

Unit

cropCorrect

calibrated factor of crop KC factor

pet_modus

Flag: index which ETP approach is used e.g. 1 for Penman-Monteith

AlbedoCanopy

Albedo of vegetation canopy (FAO,1998) default =0.23

AlbedoSoil

Albedo of bare soil surface (Supit et. al. 1994) default = 0.15

AlbedoWater

Albedo of water surface (Supit et. al. 1994) default = 0.05

co2

albedoLand

albedo from land surface (from GlobAlbedo database)

albedoOpenWater

albedo from open water surface (from GlobAlbedo database)

TMin

minimum air temperature

K

TMax

maximum air temperature

K

Psurf

Instantaneous surface pressure

Pa

Qair

specific humidity

kg/kg

Tavg

average air Temperature (input for the model)

K

Rsdl

long wave downward surface radiation fluxes

W/m2

Rsds

short wave downward surface radiation fluxes

W/m2

Wind

wind speed

m/s

ETRef

potential evapotranspiration rate from reference crop

m

EWRef

potential evaporation rate from water surface

m

Functions

dynamic()[source]

Dynamic part of the potential evaporation module

Returns

  • ETRef - potential reference evapotranspiration rate [m/day]

  • EWRef - potential evaporation rate from water surface [m/day]

dynamic_1()[source]

Dynamic part of the potential evaporation module Based on Penman Monteith - FAO 56

dynamic_2()[source]

Dynamic part of the potential evaporation module 2: Milly and Dunne method P. C. D. Milly* and K. A. Dunne, 2016: Potential evapotranspiration and continental drying, Nature Climate Change, DOI: 10.1038/NCLIMATE3046 Energy only PET = 0.8(Rn ? ) equation 8

dynamic_4()[source]

Dynamic part of the potential evaporation module 4. Priestley-Taylor 1.26 * delat https://wetlandscapes.github.io/blog/blog/penman-monteith-and-priestley-taylor/

initial()[source]

Initial part of evaporation type module Load inictial parameters

Note

Only run if calc_evaporation is True

initial_1()[source]

Initial part of evaporation type module Load initial parameters 1: Penman Monteith 2: Milly and Dunne method P. C. D. Milly* and K. A. Dunne, 2016: Potential evapotranspiration and continental drying, Nature Climate Change, DOI: 10.1038/NCLIMATE3046 Energy only PET: ET=0.8(Rn ?) equation 8 3: Yang et al. Penman Montheith correction method Yang, Y., Roderick, M. L., Zhang, S., McVicar, T. R., and Donohue, R. J.: Hydrologic implications of vegetation response to elevated CO2 in climate projections, Nat. Clim. Change, 9, 44-48, 10.1038/s41558-018-0361-0, 2019. Equation 14: where the term 2.14 accounts for changing [CO2] on rs

evaporation module

Calculate actual evapotranspiration

class cwatm.hydrological_modules.evaporation.evaporation(model)[source]

Bases: object

Evaporation module Calculate potential evaporation and pot. transpiration

Global variables

Variable [self.var]

Description

Unit

cropKC

crop coefficient for each of the 4 different land cover types (forest, irrigated

Functions

dynamic(coverType, No)[source]

Dynamic part of the soil module

calculating potential Evaporation for each land cover class with kc factor get crop coefficient, use potential ET, calculate potential bare soil evaporation and transpiration

Parameters
  • coverType – Land cover type: forest, grassland …

  • No – number of land cover type: forest = 0, grassland = 1 …

Returns

potential evaporation from bare soil, potential transpiration

interception module

Calculate interception

class cwatm.hydrological_modules.interception.interception(model)[source]

Bases: object

INTERCEPTION

Global variables

Variable [self.var]

Description

Unit

interceptCap

interception capacity of vegetation

m

availWaterInfiltrati

quantity of water reaching the soil after interception, more snowmelt

m

interceptEvap

simulated evaporation from water intercepted by vegetation

m

potTranspiration

Potential transpiration (after removing of evaporation)

m

snowEvap

total evaporation from snow for a snow layers

m

minInterceptCap

Maximum interception read from file for forest and grassland land cover

m

interceptStor

simulated vegetation interception storage

m

twothird

2/3

EWRef

potential evaporation rate from water surface

m

Rain

Precipitation less snow

m

SnowMelt

total snow melt from all layers

m

actualET

simulated evapotranspiration from soil, flooded area and vegetation

m

Functions

dynamic(coverType, No)[source]

Dynamic part of the interception module calculating interception for each land cover class

Parameters
  • coverType – Land cover type: forest, grassland …

  • No – number of land cover type: forest = 0, grassland = 1 …

Returns

interception evaporation, interception storage, reduced pot. transpiration

sealed_water module

Calculate water runoff from impermeable surface

class cwatm.hydrological_modules.sealed_water.sealed_water(model)[source]

Bases: object

Sealed and open water runoff

calculated runoff from impermeable surface (sealed) and into water bodies

Global variables

Variable [self.var]

Description

Unit

modflow

Flag: True if modflow_coupling = True in settings file

availWaterInfiltrati

quantity of water reaching the soil after interception, more snowmelt

m

capillar

Simulated flow from groundwater to the third CWATM soil layer

m

EWRef

potential evaporation rate from water surface

m

actualET

simulated evapotranspiration from soil, flooded area and vegetation

m

directRunoff

Simulated surface runoff

m

openWaterEvap

Simulated evaporation from open areas

m

actTransTotal

Total actual transpiration from the three soil layers

m

actBareSoilEvap

Simulated evaporation from the first soil layer

m

Functions

dynamic(coverType, No)[source]

Dynamic part of the sealed_water module

runoff calculation for open water and sealed areas

Parameters
  • coverType – Land cover type: forest, grassland …

  • No – number of land cover type: forest = 0, grassland = 1 …

Hydrology II - from soil to river

soil module

Calculate fluxes in 3 layer soil

class cwatm.hydrological_modules.soil.soil(model)[source]

Bases: object

SOIL

Calculation vertical transfer of water based on Arno scheme

Global variables

Variable [self.var]

Description

Unit

capRiseFrac

fraction of a grid cell where capillar rise may happen

m

storGroundwater

simulated groundwater storage

m

modflow

Flag: True if modflow_coupling = True in settings file

includeCrops

1=includeCrops option in settings file is True, 0=otherwise

Crops

Internal: List of specific crops and Kc/Ky parameters

availWaterInfiltrati

quantity of water reaching the soil after interception, more snowmelt

m

interceptEvap

simulated evaporation from water intercepted by vegetation

m

potTranspiration

Potential transpiration (after removing of evaporation)

m

snowEvap

total evaporation from snow for a snow layers

m

cropKC

crop coefficient for each of the 4 different land cover types (forest, irrigated

rootDepth

KSat1

KSat2

KSat3

genuM1

genuM2

genuM3

genuInvM1

genuInvM2

genuInvM3

ws1

Maximum storage capacity in layer 1

m

ws2

Maximum storage capacity in layer 2

m

ws3

Maximum storage capacity in layer 3

m

wres1

Residual storage capacity in layer 1

m

wres2

Residual storage capacity in layer 2

m

wres3

Residual storage capacity in layer 3

m

wrange1

wrange2

wrange3

wfc1

Soil moisture at field capacity in layer 1

wfc2

Soil moisture at field capacity in layer 2

wfc3

Soil moisture at field capacity in layer 3

wwp1

Soil moisture at wilting point in layer 1

wwp2

Soil moisture at wilting point in layer 2

wwp3

Soil moisture at wilting point in layer 3

kunSatFC12

kunSatFC23

arnoBeta

adjRoot

maxtopwater

maximum heigth of topwater

m

capillar

Simulated flow from groundwater to the third CWATM soil layer

m

EWRef

potential evaporation rate from water surface

m

FrostIndexThreshold

Degree Days Frost Threshold (stops infiltration, percolation and capillary rise)

FrostIndex

FrostIndex - Molnau and Bissel (1983), A Continuous Frozen Ground Index for Floo

actualET

simulated evapotranspiration from soil, flooded area and vegetation

m

soilLayers

Number of soil layers

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

soildepth

Thickness of the first soil layer

m

soildepth12

Total thickness of layer 2 and 3

m

w1

Simulated water storage in the layer 1

m

w2

Simulated water storage in the layer 2

m

w3

Simulated water storage in the layer 3

m

topwater

quantity of water above the soil (flooding)

m

directRunoff

Simulated surface runoff

m

interflow

Simulated flow reaching runoff instead of groundwater

m

openWaterEvap

Simulated evaporation from open areas

m

actTransTotal

Total actual transpiration from the three soil layers

m

actBareSoilEvap

Simulated evaporation from the first soil layer

m

percolationImp

Fraction of area covered by the corresponding landcover type

m

cropGroupNumber

soil water depletion fraction, Van Diepen et al., 1988: WOFOST 6.0, p.86, Dooren

cPrefFlow

Factor influencing preferential flow (flow from surface to GW)

potBareSoilEvap

potential bare soil evaporation (calculated with minus snow evaporation)

m

totalPotET

Potential evaporation per land use class

m

rws

Transpiration reduction factor (in case of water stress)

prefFlow

Flow going directly from rainfall to groundwater

m

infiltration

Water actually infiltrating the soil

m

capRiseFromGW

Simulated capillary rise from groundwater

m

NoSubSteps

Number of sub steps to calculate soil percolation

perc1to2

Simulated water flow from soil layer 1 to soil layer 2

m

perc2to3

Simulated water flow from soil layer 2 to soil layer 3

m

perc3toGW

Simulated water flow from soil layer 3 to groundwater

m

theta1

fraction of water in soil compartment 1 for each land use class

theta2

fraction of water in soil compartment 2 for each land use class

theta3

fraction of water in soil compartment 3 for each land use class

actTransTotal_forest

Transpiration from forest land cover

m

actTransTotal_grassl

Transpiration from grasslands land cover

m

actTransTotal_paddy

Transpiration from paddy land cover

m

actTransTotal_nonpad

Transpiration from non-paddy land cover

m

actTransTotal_crops_

Transpiration associated with specific irrigated crops

m

fracCrops_Irr

Fraction of cell currently planted with specific irrigated crops

%

currentKC

Current crop coefficient for specific crops

actTransTotal_month_

Internal variable: Running total of transpiration for specific irrigated crops

m

actTransTotal_crops_

Transpiration associated with specific non-irr crops

m

fracCrops_nonIrr

Fraction of cell currently planted with specific non-irr crops

actTransTotal_month_

Internal variable: Running total of transpiration for specific non-irrigated cr

m

gwRecharge

groundwater recharge

m

act_irrConsumption

actual irrigation water consumption

m

Functions

dynamic(coverType, No)[source]

Dynamic part of the soil module

For each of the land cover classes the vertical water transport is simulated Distribution of water holding capiacity in 3 soil layers based on saturation excess overland flow, preferential flow Dependend on soil depth, soil hydraulic parameters

initial()[source]

Initial part of the soil module

  • Initialize all the hydraulic properties of soil

  • Set soil depth

capillarRise module

Calculate capillar rise from groundwater

class cwatm.hydrological_modules.capillarRise.capillarRise(model)[source]

Bases: object

CAPILLAR RISE calculate cell fraction influenced by capillary rise

Global variables

Variable [self.var]

Description

Unit

dzRel0100

map of relative elevation above flood plains (max elevation above plain)

m

dzRel0090

map of relative elevation above flood plains (90% elevation above plain)

m

dzRel0080

map of relative elevation above flood plains (80% elevation above plain)

m

dzRel0070

map of relative elevation above flood plains (70% elevation above plain)

m

dzRel0060

map of relative elevation above flood plains (60% elevation above plain)

m

dzRel0050

map of relative elevation above flood plains (median elevation above plain)

m

dzRel0040

map of relative elevation above flood plains (40% elevation above plain)

m

dzRel0030

map of relative elevation above flood plains (30% elevation above plain)

m

dzRel0020

map of relative elevation above flood plains (20% elevation above plain)

m

dzRel0010

map of relative elevation above flood plains (10% elevation above plain)

m

dzRel0005

map of relative elevation above flood plains (5% elevation above plain)

m

dzRel0001

map of relative elevation above flood plains (1% elevation above plain)

m

capRiseFrac

fraction of a grid cell where capillar rise may happen

m

storGroundwater

simulated groundwater storage

m

specificYield

groundwater reservoir parameters (if ModFlow is not used) used to compute ground

m

modflow

Flag: True if modflow_coupling = True in settings file

maxGWCapRise

influence of capillary rise above groundwater level

m

Functions

dynamic()[source]

Dynamic part of the capillar Rise module calculate cell fraction influenced by capillary rise depending on appr. height of groundwater and relative elevation of grid cell

Returns

capRiseFrac = cell fraction influenced by capillary rise

groundwater module

Calculate groundwater

class cwatm.hydrological_modules.groundwater.groundwater(model)[source]

Bases: object

GROUNDWATER

Global variables

Variable [self.var]

Description

Unit

storGroundwater

simulated groundwater storage

m

specificYield

groundwater reservoir parameters (if ModFlow is not used) used to compute ground

m

recessionCoeff

groundwater storage times this coefficient gives baseflow

kSatAquifer

groundwater reservoir parameters (if ModFlow is not used), could be used to comp

m day-1

load_initial

readAvlStorGroundwat

same as storGroundwater but equal to 0 when inferior to a treshold

m

pumping_actual

prestorGroundwater

storGroundwater at the beginning of each step

m

sum_gwRecharge

groundwater recharge

m

modflow

Flag: True if modflow_coupling = True in settings file

gwstore

capillar

Simulated flow from groundwater to the third CWATM soil layer

m

baseflow

simulated baseflow (= groundwater discharge to river)

m

nonFossilGroundwater

groundwater abstraction which is sustainable and not using fossil resources

m

Functions

dynamic()[source]

Dynamic part of the groundwater module Calculate groundweater storage and baseflow

initial()[source]

Initial part of the groundwater module

  • load parameters from settings file

  • initial groundwater storage

runoff_concentration module

Calculate runoff concentration - from grid cell to grid cell corner

class cwatm.hydrological_modules.runoff_concentration.runoff_concentration(model)[source]

Bases: object

Runoff concentration

this is the part between runoff generation and routing for each gridcell and for each land cover class the generated runoff is concentrated at a corner of a gridcell this concentration needs some lag-time (and peak time) and leads to diffusion lag-time/ peak time is calculated using slope, length and land cover class diffusion is calculated using a triangular-weighting-function

Q(t) = \sum_{i=0}^{max} c(i) * Q_{\mathrm{GW}} (t - i + 1)

where c(i) = \int_{i-1}^{i} {2 \over{max}} - | u - {max \over {2}} | * {4 \over{max^2}} du

see also:

http://stackoverflow.com/questions/24040984/transformation-using-triangular-weighting-function-in-python

Global variables

Variable [self.var]

Description

Unit

load_initial

sum_interflow

baseflow

simulated baseflow (= groundwater discharge to river)

m

coverTypes

land cover types - forest - grassland - irrPaddy - irrNonPaddy - water - sealed

runoff

runoff_peak

peak time of runoff in seconds for each land use class

s

tpeak_interflow

peak time of interflow

s

tpeak_baseflow

peak time of baseflow

s

maxtime_runoff_conc

maximum time till all flow is at the outlet

s

runoff_conc

runoff after concentration - triangular-weighting method

m

gridcell_storage

sum_landSurfaceRunof

Runoff concentration above the soil more interflow including all landcover types

m

landSurfaceRunoff

Runoff concentration above the soil more interflow

m

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

directRunoff

Simulated surface runoff

m

interflow

Simulated flow reaching runoff instead of groundwater

m

prergridcell

Functions

dynamic()[source]

Dynamic part of the runoff concentration module

For surface runoff for each land cover class and for interflow and for baseflow the runoff concentration time is calculated

Note

the time demanding part is calculated in a c++ library

initial()[source]

Initial part of the runoff concentration module

Setting the peak time for:

  • surface runoff = 3

  • interflow = 4

  • baseflow = 5

based on the slope the concentration time for each land cover type is calculated

Note

only if option includeRunoffConcentration is TRUE

Hydrology III - Socio-economic - Water demand

water_demand.water_demand

Calculate water demand from different sectors

class cwatm.hydrological_modules.water_demand.water_demand.water_demand(model)[source]

Bases: object

WATERDEMAND

calculating water demand - Industrial, domenstic based on precalculated maps Agricultural water demand based on water need by plants

Global variables

Variable [self.var]

Description

Unit

domesticDemand

pot_domesticConsumpt

envFlow

readAvlStorGroundwat

same as storGroundwater but equal to 0 when inferior to a treshold

m

industryDemand

efficiencyPaddy

efficiencyNonpaddy

returnfractionIrr

irrDemand

irrPaddyDemand

irrNonpaddyDemand

waterBodyID

lakes/reservoirs map with a single ID for each lake/reservoir

waterBodyBuffer

compress_LR

boolean map as mask map for compressing lake/reservoir

decompress_LR

boolean map as mask map for decompressing lake/reservoir

MtoM3C

conversion factor from m to m3 (compressed map)

waterBodyTypCTemp

livestockDemand

pot_livestockConsump

MtoM3

Coefficient to change units

InvDtSec

cellArea

Area of cell

m2

M3toM

Coefficient to change units

channelStorage

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

nonFossilGroundwater

groundwater abstraction which is sustainable and not using fossil resources

m

lakeVolumeM3C

compressed map of lake volume

m3

lakeStorageC

m3

reservoirStorageM3C

lakeResStorageC

lakeResStorage

smalllakeVolumeM3

smalllakeStorage

act_SurfaceWaterAbst

addtoevapotrans

act_irrWithdrawal

act_nonIrrConsumptio

returnFlow

act_irrConsumption

actual irrigation water consumption

m

unmetDemand

act_nonIrrWithdrawal

returnflowIrr

nonIrrReturnFlowFrac

unmet_lost

act_totalWaterWithdr

act_bigLakeResAbst

act_smallLakeResAbst

modflowPumpingM

modflowTopography

modflowDepth2

leakageC

dom_efficiency

demand_unit

pot_industryConsumpt

ind_efficiency

unmetDemandPaddy

unmetDemandNonpaddy

totalIrrDemand

liv_efficiency

waterdemandFixed

waterdemandFixedYear

allocSegments

swAbstractionFractio

allocation_zone

modflowPumping

leakage

pumping

nonIrruse

act_indDemand

act_domDemand

act_livDemand

nonIrrDemand

totalWaterDemand

act_indConsumption

act_domConsumption

act_livConsumption

act_totalIrrConsumpt

act_totalWaterConsum

pot_GroundwaterAbstr

pot_nonIrrConsumptio

readAvlChannelStorag

act_channelAbst

reservoir_command_ar

leakageC_daily

leakageC_daily_segme

act_irrNonpaddyWithd

act_irrPaddyWithdraw

act_irrPaddyDemand

act_irrNonpaddyDeman

act_indWithdrawal

act_domWithdrawal

act_livWithdrawal

act_paddyConsumption

act_nonpaddyConsumpt

returnflowNonIrr

unmet_lostirr

unmet_lostNonirr

waterabstraction

Functions

dynamic()[source]

Dynamic part of the water demand module

  • calculate the fraction of water from surface water vs. groundwater

  • get non-Irrigation water demand and its return flow fraction

initial()[source]

Initial part of the water demand module

Set the water allocation

water_demand.domestic

Read water demand for domestic

class cwatm.hydrological_modules.water_demand.domestic.waterdemand_domestic(model)[source]

Bases: object

WATERDEMAND domestic

calculating water demand - domenstic based on precalculated maps

Global variables

Variable [self.var]

Description

Unit

domesticTime

domWithdrawalVar

domConsumptionVar

domesticDemand

pot_domesticConsumpt

InvCellArea

Inverse of cell area of each simulated mesh

m-1

M3toM

Coefficient to change units

dom_efficiency

demand_unit

Functions

dynamic(wd_date)[source]

Dynamic part of the water demand module - domestic read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

initial()[source]

Initial part of the water demand module

water_demand.industry

Read water demand for industry

class cwatm.hydrological_modules.water_demand.industry.waterdemand_industry(model)[source]

Bases: object

WATERDEMAND domestic

calculating water demand - industry based on precalculated maps

Global variables

Variable [self.var]

Description

Unit

industryTime

indWithdrawalVar

indConsumptionVar

industryDemand

InvCellArea

Inverse of cell area of each simulated mesh

m-1

M3toM

Coefficient to change units

demand_unit

pot_industryConsumpt

ind_efficiency

Functions

dynamic(wd_date)[source]

Dynamic part of the water demand module - industry read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

initial()[source]

Initial part of the water demand module - industry

water_demand.livestock

Read water demand for livestock

class cwatm.hydrological_modules.water_demand.livestock.waterdemand_livestock(model)[source]

Bases: object

WATERDEMAND livestock

calculating water demand - livestock based on precalculated maps

Global variables

Variable [self.var]

Description

Unit

domesticTime

livestockTime

livVar

uselivestock

livestockDemand

pot_livestockConsump

InvCellArea

Inverse of cell area of each simulated mesh

m-1

M3toM

Coefficient to change units

demand_unit

liv_efficiency

Functions

dynamic(wd_date)[source]

Dynamic part of the water demand module - livestock read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

initial()[source]

Initial part of the water demand module - livestock

water_demand.irrigation

Calculate water demand for irrigation

class cwatm.hydrological_modules.water_demand.irrigation.waterdemand_irrigation(model)[source]

Bases: object

WATERDEMAND

calculating water demand - irrigation Agricultural water demand based on water need by plants

Global variables

Variable [self.var]

Description

Unit

load_initial

availWaterInfiltrati

quantity of water reaching the soil after interception, more snowmelt

m

cropKC

crop coefficient for each of the 4 different land cover types (forest, irrigated

efficiencyPaddy

efficiencyNonpaddy

returnfractionIrr

alphaDepletion

pot_irrConsumption

irrDemand

irrPaddyDemand

irrNonpaddyDemand

irrNonpaddyDeman

ws1

Maximum storage capacity in layer 1

m

ws2

Maximum storage capacity in layer 2

m

wfc1

Soil moisture at field capacity in layer 1

wfc2

Soil moisture at field capacity in layer 2

wwp1

Soil moisture at wilting point in layer 1

wwp2

Soil moisture at wilting point in layer 2

arnoBeta

maxtopwater

maximum heigth of topwater

m

totAvlWater

InvCellArea

Inverse of cell area of each simulated mesh

m-1

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

w1

Simulated water storage in the layer 1

m

w2

Simulated water storage in the layer 2

m

topwater

quantity of water above the soil (flooding)

m

totalPotET

Potential evaporation per land use class

m

unmetDemand

unmetDemandPaddy

unmetDemandNonpaddy

totalIrrDemand

Functions

dynamic()[source]

Dynamic part of the water demand module

  • calculate the fraction of water from surface water vs. groundwater

  • get non-Irrigation water demand and its return flow fraction

initial()[source]

Initial part of the water demand module irrigation

water_demand.environmental_need

Read water for environmental need

class cwatm.hydrological_modules.water_demand.environmental_need.waterdemand_environmental_need(model)[source]

Bases: object

WATERDEMAND environment_need

calculating water demand - environmental need based on precalculated maps done before in CWatM

Global variables

Variable [self.var]

Description

Unit

cut_ef_map

if TRUE calculated maps of environmental flow are cut to the extend of the area

use_environflow

envFlowm3s

envFlow

M3toM

Coefficient to change units

chanLength

channelAlpha

Functions

dynamic()[source]

Dynamic part of the water demand module - environment read monthly (or yearly) water demand from netcdf and transform (if necessary) to [m/day]

initial()[source]

Initial part of the water demand module - environment

Hydrology IV - Lakes, reservoirs and river

lakes_reservoirs module

Calculate water retention in lakes

class cwatm.hydrological_modules.lakes_reservoirs.lakes_reservoirs(model)[source]

Bases: object

LAKES AND RESERVOIRS

Note

Calculate water retention in lakes and reservoirs

Using the Modified Puls approach to calculate retention of a lake See also: LISFLOOD manual Annex 3 (Burek et al. 2013)

for Modified Puls Method the Q(inflow)1 has to be used. It is assumed that this is the same as Q(inflow)2 for the first timestep has to be checked if this works in forecasting mode!

Lake Routine using Modified Puls Method (see Maniak, p.331ff)

{Qin1 + Qin2 \over{2}} - {Qout1 + Qout2 \over{2}} = {S2 - S1 \over{\delta time}}

changed into:

{S2 \over{time + Qout2/2}} = {S1 \over{dtime + Qout1/2}} - Qout1 + {Qin1 + Qin2 \over{2}}

Outgoing discharge (Qout) are linked to storage (S) by elevation.

Now some assumption to make life easier:

1.) storage volume is increase proportional to elevation: S = A * H where: H: elevation, A: area of lake

2.) Q_{\mathrm{out}} = c * b * H^{2.0} (c: weir constant, b: width)

2.0 because it fits to a parabolic cross section see (Aigner 2008) (and it is much easier to calculate (that’s the main reason)

c: for a perfect weir with mu=0.577 and Poleni: {2 \over{3}} \mu * \sqrt{2*g} = 1.7

c: for a parabolic weir: around 1.8

because it is a imperfect weir: C = c * 0.85 = 1.5

results in formular: Q = 1.5 * b * H^2 = a*H^2 -> H = \sqrt{Q/a}

Solving the equation:

{S2 \over{dtime + Qout2/2}} = {S1 \over{dtime + Qout1/2}} - Qout1 + {Qin1 + Qin2 \over{2}}

SI = {S2 \over{dtime}} + {Qout2 \over{2}} = {A*H \over{DtRouting}} + {Q \over{2}} = {A \over{DtRouting*\sqrt{a}* \sqrt{Q}}} + {Q \over{2}}

-> replacement: {A \over{DtSec * \sqrt{a}}} = Lakefactor, Y = \sqrt{Q}

Y^2 + 2 * Lakefactor *Y - 2 * SI=0

solution of this quadratic equation:

Q = (-LakeFactor + \sqrt{LakeFactor^2+2*SI})^2

Global variables

Variable [self.var]

Description

Unit

load_initial

saveInit

Flag: if true initial conditions are saved

waterBodyID

lakes/reservoirs map with a single ID for each lake/reservoir

waterBodyOut

biggest outlet (biggest accumulation of ldd network) of a waterbody

dirUp

river network in upstream direction

waterBodyBuffer

ldd_LR

change river network (put pits in where lakes are)

lddCompress_LR

compressed river network lakes/reservoirs (without missing values)

dirUp_LR

river network direction upstream lake/reservoirs

dirupLen_LR

number of bifurcation upstream lake/reservoir

dirupID_LR

index river upstream lake/reservoir

downstruct_LR

river network downstream lake/reservoir

catchment_LR

catchments lake/reservoir

dirDown_LR

river network direktion downstream lake/reservoir

lendirDown_LR

number of river network connections lake/reservoir

compress_LR

boolean map as mask map for compressing lake/reservoir

decompress_LR

boolean map as mask map for decompressing lake/reservoir

waterBodyOutC

compressed map biggest outlet of each lake/reservoir

resYearC

compressed map of the year when the reservoirs is operating

waterBodyTypC

water body types 3 reservoirs and lakes (used as reservoirs but before the year

lakeArea

area of each lake/reservoir

m2

lakeAreaC

compressed map of the area of each lake/reservoir

m2

lakeDis0

compressed map average discharge at the outlet of a lake/reservoir

m3 s-1

lakeDis0C

average discharge at the outlet of a lake/reservoir

m3 s-1

lakeAC

compressed map of parameter of channel width, gravity and weir coefficient

resVolumeC

compressed map of reservoir volume

Million m

lakeEvaFactorC

compressed map of a factor which increases evaporation from lake because of wind

reslakeoutflow

m

lakeVolume

volume of lakes

m3

outLake

outflow from lakes

m

lakeStorage

lakeInflow

lakeOutflow

reservoirStorage

MtoM3C

conversion factor from m to m3 (compressed map)

EvapWaterBodyM

lakeResInflowM

lakeResOutflowM

lakedaycorrect

lakeFactor

factor for the Modified Puls approach to calculate retention of the lake

lakeFactorSqr

square root factor for the Modified Puls approach to calculate retention of the

lakeInflowOldC

inflow to the lake from previous days

m/3

lakeOutflowC

compressed map of lake outflow

m3/s

lakeLevelC

compressed map of lake level

m

conLimitC

normLimitC

floodLimitC

adjust_Normal_FloodC

norm_floodLimitC

minQC

normQC

nondmgQC

deltaO

deltaLN

deltaLF

deltaNFL

reservoirFillC

resStorage

waterBodyTypCTemp

sumEvapWaterBodyC

sumlakeResInflow

sumlakeResOutflow

lakeIn

lakeEvapWaterBodyC

resEvapWaterBodyC

downstruct

DtSec

number of seconds per timestep (default = 86400)

s

MtoM3

Coefficient to change units

InvDtSec

cellArea

Area of cell

m2

UpArea1

upstream area of a grid cell

m2

lddCompress

compressed river network (without missing values)

lakeEvaFactor

a factor which increases evaporation from lake because of wind

dtRouting

number of seconds per routing timestep

s

evapWaterBodyC

sumLakeEvapWaterBody

noRoutingSteps

sumResEvapWaterBodyC

discharge

discharge

m3/s

prelakeResStorage

runoff

lakeVolumeM3C

compressed map of lake volume

m3

lakeStorageC

m3

reservoirStorageM3C

lakeResStorageC

lakeResStorage

Functions

dynamic()[source]

Dynamic part set lakes and reservoirs for each year

dynamic_inloop(NoRoutingExecuted)[source]

Dynamic part to calculate outflow from lakes and reservoirs

  • lakes with modified Puls approach

  • reservoirs with special filling levels

Parameters

NoRoutingExecuted – actual number of routing substep

Returns

outLdd: outflow in m3 to the network

Note

outflow to adjected lakes and reservoirs is calculated separately

initWaterbodies()[source]

Initialize water bodies Read parameters from maps e.g area, location, initial average discharge, type 9reservoir or lake) etc.

Compress numpy array from mask map to the size of lakes+reservoirs (marked as capital C at the end of the variable name)

initial_lakes()[source]

Initial part of the lakes module Using the Modified Puls approach to calculate retention of a lake

initial_reservoirs()[source]

Initial part of the reservoir module Using the appraoch of LISFLOOD

See also

LISFLOOD manual Annex 1: (Burek et al. 2013)

lakes_res_small module

Calculate water retention in small lakes

class cwatm.hydrological_modules.lakes_res_small.lakes_res_small(model)[source]

Bases: object

Small LAKES AND RESERVOIRS

Note

Calculate water retention in lakes and reservoirs

Using the Modified Puls approach to calculate retention of a lake See also: LISFLOOD manual Annex 3 (Burek et al. 2013)

Global variables

Variable [self.var]

Description

Unit

load_initial

smallpart

smalllakeArea

smalllakeDis0

smalllakeA

smalllakeFactor

smalllakeFactorSqr

smalllakeInflowOld

smalllakeOutflow

smalllakeLevel

minsmalllakeVolumeM3

preSmalllakeStorage

smallLakedaycorrect

smallLakeIn

smallevapWaterBody

smallLakeout

smallrunoffDiff

DtSec

number of seconds per timestep (default = 86400)

s

InvDtSec

cellArea

Area of cell

m2

EWRef

potential evaporation rate from water surface

m

lakeEvaFactor

a factor which increases evaporation from lake because of wind

runoff

smalllakeVolumeM3

smalllakeStorage

Functions

dynamic()[source]

Dynamic part to calculate outflow from small lakes and reservoirs

  • lakes with modified Puls approach

  • reservoirs with special filling levels

Flow out of lake:

Returns

outflow in m3 to the network

initial()[source]

Initialize small lakes and reservoirs Read parameters from maps e.g area, location, initial average discharge, type: reservoir or lake) etc.

routing_reservoirs.routing_kinematic module

River routing - kinematic wave

class cwatm.hydrological_modules.routing_reservoirs.routing_kinematic.routing_kinematic(model)[source]

Bases: object

ROUTING

routing using the kinematic wave

Global variables

Variable [self.var]

Description

Unit

load_initial

inflowM3

inflow to basin

m3

waterBodyID

lakes/reservoirs map with a single ID for each lake/reservoir

dirUp

river network in upstream direction

dirupLen_LR

number of bifurcation upstream lake/reservoir

dirupID_LR

index river upstream lake/reservoir

dirDown_LR

river network direktion downstream lake/reservoir

lendirDown_LR

number of river network connections lake/reservoir

compress_LR

boolean map as mask map for compressing lake/reservoir

lakeArea

area of each lake/reservoir

m2

lakeEvaFactorC

compressed map of a factor which increases evaporation from lake because of wind

EvapWaterBodyM

lakeResInflowM

lakeResOutflowM

downstruct

DtSec

number of seconds per timestep (default = 86400)

s

cellArea

Area of cell

m2

EWRef

potential evaporation rate from water surface

m

QInM3Old

Inflow from previous day

m3

UpArea1

upstream area of a grid cell

m2

lddCompress

compressed river network (without missing values)

lakeEvaFactor

a factor which increases evaporation from lake because of wind

dtRouting

number of seconds per routing timestep

s

evapWaterBodyC

sumLakeEvapWaterBody

noRoutingSteps

sumResEvapWaterBodyC

discharge

discharge

m3/s

prelakeResStorage

catchmentAll

sumsideflow

EvapoChannel

prechannelStorage

channelStorage

chanLength

totalCrossSectionAre

dirupLen

dirupID

catchment

dirDown

lendirDown

UpArea

beta

chanMan

chanGrad

chanWidth

chanDepth

invbeta

invchanLength

invdtRouting

totalCrossSectionAre

chanWettedPerimeterA

alpPower

channelAlpha

invchannelAlpha

riverbedExchange

QDelta

inflowDt

dis_outlet

runoff

fracVegCover

Fraction of specific land covers (0=forest, 1=grasslands, etc.)

%

openWaterEvap

Simulated evaporation from open areas

m

lakeResStorage

act_SurfaceWaterAbst

returnFlow

act_bigLakeResAbst

act_smallLakeResAbst

Functions

catchment(point)[source]

Get the catchment from “global” LDD and a point

  • load and create a river network

  • calculate catchment upstream of point

dynamic()[source]

Dynamic part of the routing module

  • calculate evaporation from channels

  • calculate riverbed exchange between riverbed and groundwater

  • if option waterbodies is true, calculate retention from water bodies

  • calculate sideflow -> inflow to river

  • calculate kinematic wave -> using C++ library for computational speed

initial()[source]

Initial part of the routing module

  • load and create a river network

  • calculate river network parameter e.g. river length, width, depth, gradient etc.

  • calculate initial filling

  • calculate manning’s roughness coefficient

routing_reservoirs.routing_sub module

Sub routines for river routing

cwatm.hydrological_modules.routing_reservoirs.routing_sub.Compress(map, mask)[source]

compressing map from 2D to 1D without missing values

Parameters
  • map – input map

  • mask – mask map

Returns

compressed map

cwatm.hydrological_modules.routing_reservoirs.routing_sub.catchment1(dirUp, points)[source]

calculates all cells which belongs to a catchment from point onward

Parameters
  • dirUp

  • points

Returns

subcatchment

cwatm.hydrological_modules.routing_reservoirs.routing_sub.decompress1(map)[source]

Decompressing map from 1D to 2D with missing values

Parameters

map – compressed map

Returns

decompressed 2D map

cwatm.hydrological_modules.routing_reservoirs.routing_sub.defLdd2(ldd)[source]

defines river network

Parameters

ldd – river network

Returns

ldd variables

cwatm.hydrological_modules.routing_reservoirs.routing_sub.dirDownstream(dirUp, lddcomp, dirDown)[source]

runs the river network tree downstream - from source to outlet

Parameters
  • dirUp

  • lddcomp

  • dirDown

Returns

direction downstream

cwatm.hydrological_modules.routing_reservoirs.routing_sub.dirUpstream(dirshort)[source]

runs the network tree upstream from outlet to source

Parameters

dirshort

Returns

direction upstream

cwatm.hydrological_modules.routing_reservoirs.routing_sub.downstream1(dirUp, weight)[source]

calculated 1 cell downstream

Parameters
  • dirUp

  • weight

Returns

dowmnstream 1 cell

cwatm.hydrological_modules.routing_reservoirs.routing_sub.lddrepair(lddnp, lddOrder)[source]

repairs a river network

  • eliminate unsound parts

  • add pits at points with no connections

Parameters
  • lddnp – rivernetwork as 1D array

  • lddOrder

Returns

repaired ldd

cwatm.hydrological_modules.routing_reservoirs.routing_sub.lddshort(lddnp, lddOrder)[source]

return short for calculating a catchment from a river network

Parameters
  • lddnp – rivernetwork as 1D array

  • lddOrder

Returns

short ldd

cwatm.hydrological_modules.routing_reservoirs.routing_sub.postorder(dirUp, catchment, node, catch, dirDown)[source]

Routine to run a postorder tree traversal

Parameters
  • dirUp

  • catchment

  • node

  • catch

  • dirDown

Returns

dirDown and catchment

cwatm.hydrological_modules.routing_reservoirs.routing_sub.subcatchment1(dirUp, points, ups)[source]

calculates subcatchments of points

Parameters
  • dirUp

  • points

  • ups

Returns

subcatchment

cwatm.hydrological_modules.routing_reservoirs.routing_sub.upstream1(downstruct, weight)[source]

Calculates 1 cell upstream

Parameters
  • downstruct

  • weight

Returns

upstream 1cell

cwatm.hydrological_modules.routing_reservoirs.routing_sub.upstreamArea(dirDown, dirshort, area)[source]

calculates upstream area

Parameters
  • dirDown – array which point from each cell to the next downstream cell

  • dirshort

  • area – area in m2 for a single gridcell

Returns

upstream area

Hydrology V - Water balance

waterbalance module

class cwatm.hydrological_modules.waterbalance.waterbalance(model)[source]

Bases: object

WATER BALANCE

  • check if water balnace per time step is ok ( = 0)

  • produce an annual overview - income, outcome storage

Global variables

Variable [self.var]

Description

Unit

storGroundwater

simulated groundwater storage

m

prestorGroundwater

storGroundwater at the beginning of each step

m

sum_gwRecharge

groundwater recharge

m

snowEvap

total evaporation from snow for a snow layers

m

preSmalllakeStorage

smallLakedaycorrect

smallLakeIn

smallevapWaterBody

smallLakeout

lakeStorage

EvapWaterBodyM

lakeResInflowM

lakeResOutflowM

resStorage

totalSto

Total soil,snow and vegetation storage for each cell including all landcover typ

m

pretotalSto

Previous totalSto

m

sum_actBareSoilEvap

sum_openWaterEvap

sum_directRunoff

sum_interflow

sum_capRiseFromGW

capillar rise from groundwater to 3rd soil layer (summed up for all land cover c

m

sum_act_irrConsumpti

sum_perc3toGW

percolation from 3rd soil layer to groundwater (summed up for all land cover cla

m

sum_prefFlow

preferential flow from soil to groundwater (summed up for all land cover classes

m

DtSec

number of seconds per timestep (default = 86400)

s

cellArea

Area of cell

m2

baseflow

simulated baseflow (= groundwater discharge to river)

m

Precipitation

Precipitation (input for the model)

m

lddCompress

compressed river network (without missing values)

discharge

discharge

m3/s

prelakeResStorage

catchmentAll

sumsideflow

EvapoChannel

prechannelStorage

channelStorage

runoff

gridcell_storage

nonFossilGroundwater

groundwater abstraction which is sustainable and not using fossil resources

m

lakeResStorage

smalllakeStorage

act_SurfaceWaterAbst

addtoevapotrans

act_irrWithdrawal

act_nonIrrConsumptio

returnFlow

unmetDemand

act_nonIrrWithdrawal

returnflowIrr

nonIrrReturnFlowFrac

unmet_lost

act_totalWaterWithdr

totalET

Total evapotranspiration for each cell including all landcover types

m

sum_actTransTotal

sum_interceptEvap

prergridcell

nonIrrReturnFlow

localQW

channelStorageBefore

sumbalance

sum_balanceStore

sum_balanceFlux

lakeReservoirStorage

Functions

checkWaterSoilGround()[source]

Check water balance of snow, vegetation, soil, groundwater

dynamic()[source]

Dynamic part of the water balance module If option sumWaterBalance sum water balance for certain variables

initial()[source]

Initial part of the water balance module

waterBalanceCheck(fluxesIn, fluxesOut, preStorages, endStorages, processName, printTrue=False)[source]

Dynamic part of the water balance module

Returns the water balance for a list of input, output, and storage map files

Parameters
  • fluxesIn – income

  • fluxesOut – this goes out

  • preStorages – this was in before

  • endStorages – this was in afterwards

  • processName – name of the process

  • printTrue – calculate it?

Returns

waterBalanceCheckSum(fluxesIn, fluxesOut, preStorages, endStorages, processName, printTrue=False)[source]

Returns the water balance for a list of input, output, and storage map files and sums it up for a catchment

Parameters
  • fluxesIn – income

  • fluxesOut – this goes out

  • preStorages – this was in before

  • endStorages – this was in afterwards

  • processName – name of the process

  • printTrue – calculate it?

Returns

Water balance as output on the screen