Skip to content

Commit e9e2aab

Browse files
committed
small further edit
1 parent c5ed832 commit e9e2aab

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

notebooks/mvp_issue_tidy_draws.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@
1313
import pandas as pd
1414
import xarray as xr
1515

16+
import forecasttools
17+
1618
# %% DEMONSTRATION OF EXPECTED BEHAVIOR
1719

18-
obs_data = np.random.normal(loc=0, scale=1, size=(1,))
20+
num_days = 1
21+
obs_data = np.random.normal(loc=0, scale=1, size=(num_days,))
1922
obs_dim_name = "obs_dim_0"
2023
start_date = "2023-01-01"
2124
interval_dates = pd.date_range(start=start_date, periods=1, freq="D")
2225
obs_group = xr.Dataset(
23-
{"obs": ([obs_dim_name], obs_data)}, coords={obs_dim_name: np.arange(1)}
26+
{"obs": ([obs_dim_name], obs_data)},
27+
coords={obs_dim_name: np.arange(num_days)},
2428
)
2529
idata = az.from_dict(observed_data={"obs": obs_group["obs"].values})
2630
idata.observed_data = idata.observed_data.assign_coords(
2731
{obs_dim_name: interval_dates}
2832
)
29-
df = idata.observed_data.to_dataframe()
30-
print(df)
33+
obs_df = idata.observed_data.to_dataframe()
34+
print(obs_df)
3135

32-
# %% FAILED EXAMPLE
36+
# %% FAILED? EXAMPLE
3337

3438

3539
def convert_date_or_datetime_to_np(
@@ -115,7 +119,15 @@ def generate_time_range_for_dim(
115119
idata.observed_data = idata.observed_data.assign_coords(
116120
{obs_dim_name: interval_dates}
117121
)
118-
df = idata.observed_data.to_dataframe()
119-
print(df)
122+
obs_df = idata.observed_data.to_dataframe()
123+
print(obs_df)
124+
125+
# %% FINAL EXAMPLE
126+
127+
idata_w_dates = forecasttools.nhsn_flu_forecast_w_dates
128+
obs_df = idata_w_dates.observed_data.to_dataframe()
129+
print(obs_df)
130+
idata_df = idata_w_dates.to_dataframe()
131+
print(idata_df.columns)
120132

121133
# %%

0 commit comments

Comments
 (0)