watbal_patch_mult: watbal_patch_mult.R

View source: R/watbal_patch_mult.R

watbal_patch_multR Documentation

watbal_patch_mult.R

Description

Water balance for multiple patches daily RHESSys output.

Usage

watbal_patch_mult(pd, cd)

Arguments

pd

Patch daily rhessys output, read into R with a funciton like 'readin_rhessys_output()'

cd

Canopy daily rhessys output, read into R with a funciton like 'readin_rhessys_output()'

Details

Before you run the water balance script below, you must have added a "rain" column to your patch daily output data that contains the patch-specific precipitation. Be careful to add the right precip values if your worldfile uses multiple base stations, isohyets, or a precip lapse rate.

This function will add a number of fields to your patch output file, the last of which will be called "watbal". This is your water balance error. You should see a minor numerical error here even if your water balances (on the order of 10^-6). If your watbal values are negative then water inputs are less than water outputs, and vice versa.

If you have multiple patches with only a single stratum per patch, you need to run a different script to loop through patches individually, call the water balance function, then write the output. For example, if your patch output is called "pd", your canopy output is called "cd", and you want the water balance output written to atable called "out", then you would type: "out=pwatbalmult(pd,cd)". This creates a new output table, called "out" in this example, that contains date fields and a single column for each patch with the water balance error for that patch (called "P345","P578","P900", etc. where the field label number matches the patch ID). You might see a minor numerical error here even if your water balances (on the order of 10^-6). If your watbal values are negative then water inputs are less than wateroutputs and vice versa. Note that this may take a long time to run if you have many patches; better to run on a single patch or a single hillslope than a full basin.


ryanrbart/RHESSysIOinR documentation built on March 30, 2024, 11:15 p.m.