File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
zppy_interfaces/global_time_series/coupled_global Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -178,11 +178,23 @@ def process_variable(
178178 # 2. Load only this variable's data
179179 dataset = xcdat .open_mfdataset (file_paths , center_times = True )
180180
181+ # For TOTAL metrics, eagerly load area fields to avoid lazy computation issues
182+ if var .metric == Metric .TOTAL :
183+ if "valid_area_per_gridcell" in dataset :
184+ dataset ["valid_area_per_gridcell" ].load ()
185+ if "area" in dataset :
186+ dataset ["area" ].load ()
187+ if "landfrac" in dataset :
188+ dataset ["landfrac" ].load ()
189+
181190 try :
182191 # 3. Compute annual average
183192 annual_dataset = dataset .temporal .group_average (var .variable_name , "year" )
184193 data_array = annual_dataset .data_vars [var .variable_name ]
185194
195+ # Eagerly load the result to avoid lazy computation issues
196+ data_array .load ()
197+
186198 # 4. Apply area scaling if needed
187199 data_array = apply_scaling (data_array , var .metric , dataset )
188200
You can’t perform that action at this time.
0 commit comments