grat.reports.selector
¶
Builds the reports a caller asked for, and writes them.
report_picker
¶
report_picker(
names,
output_folder,
year,
sites,
year_raw_wafr,
wafr,
bottlenecks=None,
transfer_list=None,
)
Generates the reports for a single year of results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
report names to generate. Post-run names are accepted and used only to decide which intermediates this year must contribute to. |
required | |
output_folder
|
folder to write into, or None to build the dataframes |
required | |
year
|
the current year |
required | |
sites
|
list of the sites objects |
required | |
year_raw_wafr
|
the unmodified WAFR for this year |
required | |
wafr
|
the end wafr after water has been applied to the sites |
required | |
bottlenecks
|
list of bottlenecks, or None if the run has none |
None
|
|
transfer_list
|
list of zones that can receive water from transfers |
None
|
Returns: dict of report name to dataframe, for the reports produced this year
Raises:
| Type | Description |
|---|---|
KeyError
|
a name is not a known report. |
Source code in src/grat/reports/selector.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
post_process
¶
Builds the reports that can only run once every water year is done.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
report names that were selected. |
required | |
output_folder
|
path to the output folder. |
required | |
produced
|
report names that report_picker produced. |
None
|
dict of report name to result, holding the frontend series as json-ready
| Type | Description |
|---|---|
|
dicts and the post-run csv reports as dataframes |
Raises:
| Type | Description |
|---|---|
KeyError
|
a name is not a known report. |
Source code in src/grat/reports/selector.py
post_process_viz_recharge_by_type
¶
Outputs the JSON used to build the frontend chart visualizations using report 2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annual_summary_recharge_df
|
report 2 values for every water year |
required |
Returns: dict keyed by "Years" and "Total" of recharge volumes by type
Source code in src/grat/reports/selector.py
post_process_unused_wafr
¶
Post process the unused vs original WAFR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wafr_unused_and_orig_all_years
|
input and unused WAFR by source, every water year |
required |
Returns: dict of WAFR source to its input and unused volumes
Source code in src/grat/reports/selector.py
post_process_max_per_site
¶
Post process the max used volume per site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
WAFR applied per site for every water year |
required |
Returns: dict of gratID to the largest single-year used volume, omitting sites that used nothing
Source code in src/grat/reports/selector.py
post_process_recharge_by_sustain_zone
¶
Post process to get the WAFR by sustainability zone for the whole run.
Sums the recharge by sustainability zone collected from each of the model year runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
total recharge by sustainability zone for every water year |
required |
Returns: dictionary with sustainability zone as key and total acre-feet as value