Skip to content

Commit 4cae255

Browse files
committed
total rain between onset and cessation, multiplying size of problem by munber of years
1 parent 3e2ac5a commit 4cae255

File tree

3 files changed

+50
-22
lines changed

3 files changed

+50
-22
lines changed

enacts/config-defaults.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ onset:
6666
menu_label: How likely is the rainy season lasting less than...
6767
description: The map shows the probability of the rainy season
6868
to last less than a certain number of days through all the years of available data.
69-
#total_mean:
70-
# menu_label: How much rain falls in the rainy season?
71-
# description: The map shows the average precipitation (in mm) during the rainy season,
72-
# defined as the period between onset and cessation dates,
73-
# over all years of available data.
74-
#total_stddev:
75-
# menu_label: How uncertain is the amount of rain in the rainy season?
76-
# description: The map shows the standard deviation from the average precipitation in the season,
77-
# over all years of available data.
78-
#total_pe:
79-
# menu_label: How likely is it raining less than...
80-
# description: The map shows the probability of precipitation in the rainy season
81-
# being less than a certain amount through all the years of available data.
69+
total_mean:
70+
menu_label: How much rain falls in the rainy season?
71+
description: The map shows the average precipitation (in mm) during the rainy season,
72+
defined as the period between onset and cessation dates,
73+
over all years of available data.
74+
total_stddev:
75+
menu_label: How uncertain is the amount of rain in the rainy season?
76+
description: The map shows the standard deviation from the average precipitation in the season,
77+
over all years of available data.
78+
total_pe:
79+
menu_label: How likely is it raining less than...
80+
description: The map shows the probability of precipitation in the rainy season
81+
being less than a certain amount through all the years of available data.
8282

8383

8484
# Water Balance Monitoring

enacts/config-zmd.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,7 @@ onset:
104104
map_max: 180
105105
length_stddev:
106106
map_max: 40
107-
107+
total_mean:
108+
map_max: 1100
109+
total_stddev:
110+
map_max: 300

enacts/onset/maproom.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,15 +853,19 @@ def onset_tile(tz, tx, ty):
853853
cess_soil_moisture,
854854
cess_dry_spell,
855855
)
856+
if cess_dates["T"][0] < onset_dates["T"][0]:
857+
cess_dates = cess_dates.isel({"T": slice(1, None)})
858+
if cess_dates["T"].size != onset_dates["T"].size:
859+
onset_dates = onset_dates.isel({"T": slice(None, -2)})
860+
cess_dates = (cess_dates["T"] + cess_dates["cess_delta"]).drop_indexes("T")
861+
onset_dates = (onset_dates["T"] + onset_dates["onset_delta"]).drop_indexes("T")
856862
if "length" in map_choice:
857-
if cess_dates["T"][0] < onset_dates["T"][0]:
858-
cess_dates = cess_dates.isel({"T": slice(1, None)})
859-
if cess_dates["T"].size != onset_dates["T"].size:
860-
onset_dates = onset_dates.isel({"T": slice(None, -2)})
861-
seasonal_length = (
862-
(cess_dates["T"] + cess_dates["cess_delta"]).drop_indexes("T")
863-
- (onset_dates["T"] + onset_dates["onset_delta"]).drop_indexes("T")
864-
) #.astype("timedelta64[D]")
863+
seasonal_length = cess_dates - onset_dates
864+
else:
865+
seasonal_total = precip_tile.where(
866+
(precip_tile["T"] >= onset_dates.rename({"T": "Ty"}))
867+
& (precip_tile["T"] <= cess_dates.rename({"T": "Ty"}))
868+
).sum("T")
865869
if map_choice == "mean":
866870
map_data = onset_dates.onset_delta.mean("T")
867871
map_max = np.timedelta64(search_days, 'D')
@@ -886,6 +890,17 @@ def onset_tile(tz, tx, ty):
886890
map_data = (seasonal_length < np.timedelta64(prob_exc_thresh_length, 'D')).mean("T") * 100
887891
map_max = 100
888892
colormap = pingrid.CORRELATION_COLORMAP
893+
if map_choice == "total_mean":
894+
map_data = seasonal_total.mean("Ty")
895+
map_max = CONFIG["map_text"][map_choice]["map_max"]
896+
colormap = pingrid.RAINFALL_COLORMAP
897+
if map_choice == "total_stddev":
898+
map_data = seasonal_total.std(dim="Ty", skipna=True)
899+
map_max = CONFIG["map_text"][map_choice]["map_max"]
900+
if map_choice == "total_pe":
901+
map_data = (seasonal_total < prob_exc_thresh_tot).mean("Ty") * 100
902+
map_max = 100
903+
colormap = pingrid.CORRELATION_COLORMAP
889904
map_data.attrs["colormap"] = colormap
890905
map_data = map_data.rename(X="lon", Y="lat")
891906
map_data.attrs["scale_min"] = map_min
@@ -928,6 +943,16 @@ def set_colorbar(search_start_day, search_start_month, search_days, map_choice):
928943
tick_freq = 5
929944
map_max = CONFIG["map_text"][map_choice]["map_max"]
930945
unit = "days"
946+
if map_choice == "total_mean":
947+
colorbar = pingrid.to_dash_colorscale(pingrid.RAINFALL_COLORMAP)
948+
tick_freq = 100
949+
map_max = CONFIG["map_text"][map_choice]["map_max"]
950+
unit = "mm"
951+
if map_choice == "total_stddev":
952+
tick_freq = 30
953+
)
954+
map_max = CONFIG["map_text"][map_choice]["map_max"]
955+
unit = "mm"
931956
if map_choice == "monit":
932957
precip = rr_mrg.precip.isel({"T": slice(-366, None)})
933958
search_start_dm = calc.sel_day_and_month(

0 commit comments

Comments
 (0)