Skip to content

chunking pressure in eos at the wrong time? #148

Description

@mnlevy1981

@sgyeager ran into an issue where calling eos() when salt and temp are dask arrays but depth is a numpy array (well, all three are of type DataArray, but under the xarray wrapper it's dask, dask, numpy) took several minutes while still returning a dask object, but chunking depth so it was a dask array as well let eos() finish in under a second. I think the problem is in https://github.com/NCAR/pop-tools/blob/main/pop_tools/eos.py#L100

        salt, temp, pressure = xr.broadcast(salt, temp, pressure)
        if isinstance(salt.data, dask.array.Array):
            pressure = pressure.chunk(salt.chunks)

wouldn't it make more sense to chunk pressure before the xr.broadcast()? I.e.

        if isinstance(salt.data, dask.array.Array):
            pressure = pressure.chunk(salt.chunks)
        salt, temp, pressure = xr.broadcast(salt, temp, pressure)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions