Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Add a chapter on how to use icclim.create_optimized_zarr_store #138

Open
bzah opened this issue Mar 15, 2022 · 5 comments
Open

DOC: Add a chapter on how to use icclim.create_optimized_zarr_store #138

bzah opened this issue Mar 15, 2022 · 5 comments

Comments

@bzah
Copy link
Member

bzah commented Mar 15, 2022

Description

The new rechunking feature is available but the documentation for it is limited.

We could either create a dedicated chapter (rst document) or add a section in our dask.rst.

The doc should describe

  • why this feature was needed
  • how to use it
  • what are the limits

Additionally, a didactic notebook using this feature would be great.

@pagecp
Copy link
Collaborator

pagecp commented Mar 15, 2022

Yes I think a dedicated chapter + a notebook is needed.

@bzah bzah mentioned this issue Mar 24, 2022
4 tasks
@bzah
Copy link
Member Author

bzah commented Mar 28, 2022

I have added a section in "the art of chunking"
I think it make sense to have this within the dask/chunking/perfs chapter.

@scorbarieu
Copy link

scorbarieu commented Apr 26, 2022

hi, happy to join the icclim community. I check the section on the art of chunking and gave it a try on TX90p. It seems I have an issue with chunking parameter which is not recognised:

CODE
using icclim 5.1.0

with icclim.create_optimized_zarr_store(
    in_files= ds,
    var_names="tasmaxAdjust",
    target_zarr_store_name="opti.zarr",
    keep_target_store = False,
    chunking={"time": -1, "i":"auto", "j":"auto" },
) as opti_tas :
     icclim.index(
        index_name="TX90p",
        in_files=opti_tas,
        slice_mode="month",
        base_period_time_range=[base_dt1, base_dt2],
        time_range=[dt1, dt2],
        out_unit='%',
        out_file=out_f_TX90p,
    )

ERROR

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [42], in <cell line: 6>()
      1 start_time = time.time()
      2 #catch wanring does not work like this
      3 #with warnings.catch_warnings():
      4 #    warnings.filterwarnings(action='ignore', message='All-NaN slice encountered')
----> 6 with icclim.create_optimized_zarr_store(
      7     in_files= ds,
      8     var_names="tasmaxAdjust",
      9     target_zarr_store_name="opti.zarr",
     10     keep_target_store = False,
     11     chunking={"time": -1, "i":"auto", "j":"auto" },
     12 ) as opti_tas :
     13      icclim.index(
     14         index_name="TX90p",
     15         in_files=opti_tas,
   (...)
     20         out_file=out_f_TX90p,
     21     )
     23 #ds_tx90p = icclim.index(index_name='TX90p', in_files=ds, var_name='tasmaxAdjust', slice_mode='month', base_period_time_range=[base_dt1, base_dt2], time_range=[dt1, dt2], out_unit='%', out_file=out_f_TX90p, logs_verbosity='HIGH')

File /usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:263, in contextmanager.<locals>.helper(*args, **kwds)
    261 @wraps(func)
    262 def helper(*args, **kwds):
--> 263     return _GeneratorContextManager(func, args, kwds)

File /usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:87, in _GeneratorContextManagerBase.__init__(self, func, args, kwds)
     86 def __init__(self, func, args, kwds):
---> 87     self.gen = func(*args, **kwds)
     88     self.func, self.args, self.kwds = func, args, kwds
     89     # Issue 19330: ensure context manager instances have good docstrings

TypeError: create_optimized_zarr_store() got an unexpected keyword argument 'chunking'

@bzah
Copy link
Member Author

bzah commented Apr 26, 2022

Hi @scorbarieu, this is an issue with our documentation I was just fixing a few minutes ago !
The "chunking" attribute is only available in icclim 5.2 which is yet to be released.

You should check the stable version (5.1.0) of RTD here: https://icclim.readthedocs.io/en/stable/

In the future, "stable" documentation should be displayed by default on readthedocs and "latest" will be available on the version selector.


Note that, without "chunking" parameter, the create_optimized_zarr_store behavior is to create a zarr store where time is unchunked and other dimensions are "auto" chunked.

@scorbarieu
Copy link

Oh thanks sorry I did not pay attention! Thanks I will try that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants