Skip to content

Commit b7cbee9

Browse files
print Docker image size and fix CSV test
1 parent 0b00aec commit b7cbee9

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- name: Build dea-conflux image
2323
run: |
2424
docker compose build
25+
docker image inspect "$(docker compose images -q conflux)" --format='dea-conflux image size: {{.Size}} bytes'
2526
2627
- name: Setup dea-conflux test environment
2728
run: |

dea_conflux/stack.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def save_df_as_csv(single_polygon_df, feature_id, outpath, remove_duplicated_dat
281281
# Remove the timeseries duplicated data
282282
single_polygon_df = remove_timeseries_with_duplicated(single_polygon_df)
283283
single_polygon_df["nwi_id"] = single_polygon_df.index
284-
single_polygon_df.reset_index(inplace=True)
284+
single_polygon_df.reset_index(drop=True, inplace=True)
285285

286286
# WIT Normalise Step
287287

@@ -319,9 +319,8 @@ def save_df_as_csv(single_polygon_df, feature_id, outpath, remove_duplicated_dat
319319
single_polygon_df = dea_tools.wetlands.generate_low_quality_data_periods(single_polygon_df)
320320
print(single_polygon_df)
321321
dea_tools.wetlands.display_wit_stack_with_df(single_polygon_df, feature_id, feature_id, x_axis_labels="years")
322-
# Drop only the temporary reset_index column; veg_areas and overall_veg_num
323-
# are retained as they are defined in the WIT data dictionary.
324-
single_polygon_df.drop(["index"], axis=1, inplace=True)
322+
# veg_areas and overall_veg_num are retained as they are defined in the WIT
323+
# data dictionary.
325324
single_polygon_df.rename(columns=WIT_CSV_COLUMN_RENAMES, inplace=True)
326325
# Reorder to match WIT_CSV_COLUMN_ORDER; any unlisted columns go at the end.
327326
ordered = [c for c in WIT_CSV_COLUMN_ORDER if c in single_polygon_df.columns]

tests/test_stack.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,23 @@ def test_wit_csv_column_names_match_data_dictionary(tmp_path, monkeypatch):
119119
)
120120

121121
csv = pd.read_csv(output)
122-
assert {
122+
assert list(csv.columns) == [
123123
"nwi_id",
124+
"date",
124125
"green_vegetation",
125126
"dry_vegetation",
126127
"bare_soil",
127128
"wetness",
128-
}.issubset(csv.columns)
129-
assert not {"feature_id", "pv", "npv", "bs", "wet"}.intersection(csv.columns)
129+
"water",
130+
"veg_areas",
131+
"overall_veg_num",
132+
"norm_bs",
133+
"norm_pv",
134+
"norm_npv",
135+
"off_value",
136+
"pc_missing",
137+
]
138+
assert csv.loc[0, "nwi_id"] == WIT_POLYGON_ID
130139

131140

132141
# def test_wit_stacking(tmp_path):

0 commit comments

Comments
 (0)