Describe the bug
A lot of computational memory and time seems to be devoted to reshaping and rechunking in compute_cloud_optics (and possibly in compute_gas_optics -- untested). This is likely related to the inconsistency between the chunking of the input and output (#191).
To Reproduce
Steps to reproduce the behavior
- Load
atmosphere of type xarray.Dataset:

cloud_optics = load_cloud_optics(cloud_optics_file=CloudOpticsFiles.SW_BND)
clouds_optical_props = cloud_optics.compute_cloud_optics(atmosphere, problem_type="two-stream")
- I ran the following code to monitor progress, but the essential line is
clouds_optical_props = clouds_optical_props.persist()
# Progress bar with the distributed scheduler
from dask.distributed import Client, progress
client = Client() # use dask.distributed by default
clouds_optical_props = clouds_optical_props.persist() # start computation in the background
progress(clouds_optical_props ) # watch progress
Here is the progress report of the above block of code:

I observed server memory spiking to around 80gb during the computations and my server eventually crashes (the server memory limit is 128gb so maybe a memory overflow caused the crash but I am not fully certain as to what causes the crash). As an alternative to step 3, I have tried tau_arr_swbndsum = clouds_optical_props.tau.sum("bnd", skipna=True).persist() (and analogously for g and ssa) and that code works but I still observe memory spikes to around 50gb. The progress report:

Expected behavior
Is all that rechunking and reshaping necessary?
Software Versions:
- OS:
Ubuntu 22.04.5 LTS
pyrte_rrtmgp, rte_rrtmgp, dask, xarray versions: 0.0.9, 1.9.1, 2025.3.1, 2025.3.0
Describe the bug
A lot of computational memory and time seems to be devoted to reshaping and rechunking in
compute_cloud_optics(and possibly incompute_gas_optics-- untested). This is likely related to the inconsistency between the chunking of the input and output (#191).To Reproduce
Steps to reproduce the behavior
atmosphereof typexarray.Dataset:cloud_optics = load_cloud_optics(cloud_optics_file=CloudOpticsFiles.SW_BND)clouds_optical_props = cloud_optics.compute_cloud_optics(atmosphere, problem_type="two-stream")clouds_optical_props = clouds_optical_props.persist()Here is the
progressreport of the above block of code:I observed server memory spiking to around 80gb during the computations and my server eventually crashes (the server memory limit is 128gb so maybe a memory overflow caused the crash but I am not fully certain as to what causes the crash). As an alternative to step 3, I have tried
tau_arr_swbndsum = clouds_optical_props.tau.sum("bnd", skipna=True).persist()(and analogously forgandssa) and that code works but I still observe memory spikes to around 50gb. Theprogressreport:Expected behavior
Is all that rechunking and reshaping necessary?
Software Versions:
Ubuntu 22.04.5 LTSpyrte_rrtmgp,rte_rrtmgp,dask,xarrayversions:0.0.9,1.9.1,2025.3.1,2025.3.0