# How to use Dagger.jl's blocks to read a multifile NCDataset?

**URL:** https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264
**Category:** General Usage
**Created:** [May 16, 2019, 12:50am UTC](https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264 "2019-05-16T00:50:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)
#### Post date: [May 16, 2019, 12:50am UTC](https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264/1 "2019-05-16T00:50:23Z")

</div>

Hi!

I’m trying to load a multifile dataset using NCDatasets, and to speed things up I am trying to use dagger in this way

```nohighlight
include("test/test_catarrays.jl") # this creates some small test files
mfds = Dataset(fnames);
X = Distribute(Blocks(2,3,1), variable(mfds,"var"))
collect(sum(X,dims = 3))
# same results as
sum(variable(mfds,"var")[:,:,:],dims = 3)

```

This is something experimental in NCDatasets and I saw it in [here](https://github.com/Alexander-Barth/NCDatasets.jl/issues/16#issuecomment-439649331) Now, I’ve tried to use it to load my own variables but I don’t really get the meaning of `Blocks` and how should I select that. So far I have only discovered that if I pass `Blocks` a different number of arguments than the dimensions in the array to be read from the file, it throws an error. Other than that I don’t seem to notice how to make it work, sometimes it just stays there forever without completing the task.

Does anyone have any experience using Dagger that can throw a light on this?

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [May 16, 2019, 12:54am UTC](https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264/2 "2019-05-16T00:54:16Z")

</div>

Hey again! Two things:

1. Can you post an MWE so we can easily reproduce what you’re trying to do?: [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757)

2. Your two questions at the end of your post were accidentally included in your code block; you should move them outside the block so it’s obvious that you want people to answer them 😛

---

<div class="post-metadata">

### Author: ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)
#### Post date: [May 16, 2019, 1:01am UTC](https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264/3 "2019-05-16T01:01:50Z")

</div>

I will try to prepare a MWE. Fell free to remove the post and I can create it again with the full info!

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [May 16, 2019, 11:08am UTC](https://discourse.julialang.org/t/how-to-use-dagger-jls-blocks-to-read-a-multifile-ncdataset/24264/4 "2019-05-16T11:08:46Z")

</div>

No need to delete it, just edit the original post and then reply here so we know that it’s been updated 🙂
