Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 4b1b7c1

Browse files
authored
Load data into memory if live (#660)
1 parent 8036158 commit 4b1b7c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nowcasting_dataset/data_sources/satellite/satellite_data_source.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,17 @@ def _load_geostationary_area_definition_and_transform(self) -> None:
107107
).transform
108108

109109
def _open_data(self) -> xr.DataArray:
110-
return open_sat_data(
110+
data_array = open_sat_data(
111111
zarr_path=self.zarr_path,
112112
consolidated=self.consolidated,
113113
logger=self.logger,
114114
sample_period_minutes=self.sample_period_minutes,
115115
)
116+
# If live, then load into memory so the data
117+
# doesn't disappear while its being used
118+
if self.is_live:
119+
data_array = data_array.load()
120+
return data_array
116121

117122
@staticmethod
118123
def get_data_model_for_batch():

0 commit comments

Comments
 (0)