Commit 5a862f51 authored by Chris Jewell's avatar Chris Jewell
Browse files

Merge branch 'weekly_100k' into 'master'

Weekly 100k

See merge request !26
parents 1872c633 2d75bb87
......@@ -98,3 +98,28 @@ def insample_predictive_timeseries(input_files, output_dir, lag):
)
plt.savefig(output_dir.joinpath(f"{location.data}.png"))
plt.close()
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"--data_pkl", type=str, required=True, help="Pipeline data pickle"
)
parser.add_argument(
"--insample",
type=str,
required=True,
help="Insample prediction netCDF4",
)
parser.add_argument(
"--output-dir", type=str, required=True, help="Output directory"
)
parser.add_argument("--lag", type=int, required=True, help="Lag")
args = parser.parse_args()
insample_predictive_timeseries(
[args.insample, args.data_pkl], args.output_dir, args.lag
)
......@@ -50,7 +50,11 @@ def weekly_pred_cases_per_100k(prediction, popsize):
# TODO: Find better way to sum up into weeks other than
# a list comprehension.
weeks = range(0, prediction.coords["time"].shape[0], 7)[:-1]
dates = pd.DatetimeIndex(prediction.coords["time"].data)
first_sunday_index = np.where(dates.weekday == 6)[0][0]
weeks = range(first_sunday_index, prediction.coords["time"].shape[0], 7)[
:-1
]
week_incidence = [
prediction[..., week : (week + 7)].sum(dim="time") for week in weeks
]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment