Module doc_helper¶
configure_hourly_gr4j(simulation)
¶
Configure a simulation with GR4J models for hourly time step modelling
Configure a simulation with GR4J models for hourly time step modelling
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A swift simulation object |
required |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
create_gr4jh_parameters()
¶
Get a parameter set that configures GR4J for hourly operations
Get a parameter set that configures GR4J for hourly operations
Returns:
Name | Type | Description |
---|---|---|
HyperCubeParameteriser |
a parameter set that can be applied to SWIFT systems with GR4J |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
define_gr4j_scaled_parameter(ref_area=250, time_span=3600, pspec_gr4j=None)
¶
define a scaled and transformed parameterizer for GR4J
define a scaled and transformed parameterizer for GR4J
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_area |
float
|
the reference area in square kilometres |
250
|
time_span |
int
|
the time span of the simulation intented for this model, in seconds |
3600
|
pspec_gr4j |
pd.DataFrame
|
optional - data frame specifying the feasible parameter space for parameters x1 to x2 of GR4J |
None
|
Returns:
Name | Type | Description |
---|---|---|
TransformParameteriser |
a parameterizer for GR4J, combining time and area scaling and superimposed with log10 transforms for x1, x3, x4 and arc-sinh for x2 |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
get_catchment_dot_graph(simulation)
¶
Gets a catchment representation in Graphviz DOT format
Gets a catchment representation in Graphviz DOT format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A swift simulation object |
required |
Returns:
Type | Description |
---|---|
a string in a notation usable by the DiagrammeR package. |
Examples:
TODO
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
get_free_params(model_id)
¶
Get a default parameter set for models
Get a default parameter set for models, as a data frame
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id |
Any
|
an identifier for the model, e.g. 'GR5H' |
required |
Returns:
Type | Description |
---|---|
a data frame with Min, Max, Value, Name |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
|
gr4j_scaled_parameteriser(reference_area=240, t_step_seconds=3600)
¶
Get a time step and area scaled parameterizer for the GR4 model structure
Get a time step and area scaled parameterizer for the GR4 model structure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reference_area |
Any
|
The reference area in km^2 for the parameter x4 |
240
|
t_step_seconds |
Any
|
The simulation time step in seconds. |
3600
|
Returns:
Type | Description |
---|---|
A SWIFT catchment parameterizer for GR4 model structures |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
inspect(simulation, element='link', id='1', full_names=False)
¶
Inspect an element of a catchment model
Inspect the current state values of an element of a catchment model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A swift simulation object |
required |
element |
Any
|
type of top level element, within c('link','node','subarea') |
'link'
|
id |
Any
|
SWIFT simulation |
'1'
|
full_names |
Any
|
if TRUE returns the full names of state variable ids (e.g. link.link_1.OutlfowRate) |
False
|
Returns:
Type | Description |
---|---|
named numeric vector, the current state values of the catchment model element |
Examples:
TODO
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
sample_catchment_model(site_id='South_Esk', config_id='catchment')
¶
Deserialize a basic catchment structure from the package sample data
Deserialize a basic catchment structure from the package sample data. This function is mostly for documentation purposes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
site_id |
Any
|
a site identifier |
'South_Esk'
|
config_id |
Any
|
a variable identifier for a model structure valid for the given site_id |
'catchment'
|
Returns:
Type | Description |
---|---|
a model simulation |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
sample_series(site_id='MMH', var_name='rain')
¶
Deserialize information to a UTC time series
Deserialize information to a UTC time series. This function is overcoming some behaviors in saving/loading xts series to/from binary RData format. Usage is not intended for most users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
site_id |
Any
|
a site identifier |
'MMH'
|
var_name |
Any
|
a variable identifier valid for the given site_id |
'rain'
|
Returns:
Type | Description |
---|---|
an xts time series with UTC time indexing |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
sce_parameter(nparams, nshuffle=40)
¶
Create SCE parameters suited for a given number of parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nparams |
int
|
number of free model parameters |
required |
nshuffle |
int
|
maximum number of shuffles to do, if no other termination criterion. Defaults to 40. |
40
|
Returns:
Type | Description |
---|---|
Dict[str, float]
|
Dict[str,float]: SCE hyperparameters |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
set_loglik_param_keys(a='a', b='b', m='m', s='s', maxobs='maxobs', ct='ct', censopt='CensOpt')
¶
Specify the global parameter names to use in the log-likelihood calculation
Specify the global parameter names to use in the log-likelihood calculation. Consequence of prehistoric legacy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
str
|
the name of the a parameter |
'a'
|
b |
str
|
the name of the b parameter |
'b'
|
m |
str
|
the name of the m parameter |
'm'
|
s |
str
|
the name of the s parameter |
's'
|
maxobs |
str
|
the name of the maxobs parameter |
'maxobs'
|
ct |
str
|
the name of the ct parameter |
'ct'
|
censopt |
str
|
the name of the censopt parameter |
'CensOpt'
|
Examples:
TODO
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
set_sample_data(model_sim, site_id='MMH', rain_data_var='rain', evap_data_var='evap', rain_model_var='P', evap_model_var='E', t_step='daily')
¶
Sets sample input data into a model simulation
Sets input data from the included sample data into a model simulation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_sim |
Any
|
an S4 object 'ExternalObjRef' [package "cinterop"] with external pointer type "MODEL_SIMULATION_PTR" |
required |
site_id |
Any
|
sample data site identifier |
'MMH'
|
rain_data_var |
Any
|
time series ID for the rainfall in the sample data |
'rain'
|
evap_data_var |
Any
|
time series ID for the evaporation in the sample data |
'evap'
|
rain_model_var |
Any
|
sub-area runoff model state identifier for the rainfall, e.g. 'P' |
'P'
|
evap_model_var |
Any
|
sub-area runoff model state identifier for the evaporation, e.g. 'E' |
'E'
|
t_step |
Any
|
identifier for the time step to set the simulation to. |
'daily'
|
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/doc_helper.py
short_var_id(var_ids)
¶
Shorten long model variable identifiers to the short model variable name
Shorten long model variable identifiers to the short model variable name. This is useful for instance to prepare time series names for multi-plot displays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
var_ids |
Any
|
character vector |
required |
Returns:
Type | Description |
---|---|
VecStr
|
the short model variable identifiers |
Examples: