xarray-contrib / xarray-tutorial

Xarray Tutorials
https://tutorial.xarray.dev/
Apache License 2.0
174 stars 108 forks source link

dask chunking tutorial outline #157

Open dcherian opened 1 year ago

dcherian commented 1 year ago

from the pangeo working meeting discussion with @mgrover1 @jmunroe @norlandrhagen

Here's an outline for an intermediate tutorial talking about dask chunking specifically for Xarray users


Motivation: why care about chunk size?

Keeping track

Why is it important to choose appropriate chunks early in the pipeline?

Specify chunks when reading data

  1. Avoid chunks="auto".
  2. Specifying chunks during data read
    • open_dataset
    • open_mfdataset
  3. Analysis vs storage chunks:
    • Dask chunks should be a multiple of chunks on disk
    • talk about aligning chunks with files stored on disk
    • @djhoese example
scottyhq commented 1 year ago

Agreed this would be great to document thoroughly. See also this relevant issue + discussion in rioxarray https://github.com/corteva/rioxarray/issues/253

djhoese commented 1 year ago

demonstrate relation between chunk size and computation time / number of tasks with a simple example?

  • maybe even memory usage

This would be huge! This comes up often in Satpy where users want to process satellite images on their local machine but they only have 8GB or 16GB of memory. If someone can make a good diagram showing chunks being processed by a worker thread/process and how changing the size of all chunks or number of workers contributes to the overall memory usage that would be such a help when explaining this to users.

dcherian commented 1 year ago

forgot to cc @rybchuk!