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

solve chunking warning #679

Closed
veenstrajelmer opened this issue Nov 23, 2023 · 0 comments · Fixed by #742
Closed

solve chunking warning #679

veenstrajelmer opened this issue Nov 23, 2023 · 0 comments · Fixed by #742

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Nov 23, 2023

import dfm_tools as dfmt
file_nc = r'p:\11209231-001-dwsm-slib2023\02_Modelling\04_Mud\Mud_v2_20162017_rst2\DFM_OUTPUT_DWSM-FM_200m\DWSM-FM_200m_0000_map.nc'
uds = dfmt.open_partitioned_dataset(file_nc)

or:

import xugrid as xu
file_nc = r'p:\11208983-epd-support-tools\toolbox\short_simulation\HK-DFM_scenario\DFM_OUTPUT_HK-FMWAQ\HK-FMWAQ_0000_map.nc'
uds = xu.open_dataset(file_nc, chunks={'time':1})

Raises " UserWarning: The specified chunks separate the stored chunks along dimension "time" starting at index 1. This could degrade performance. Instead, consider rechunking after loading."

This might be because of the default chunks={"time":1} of open_partitioned_dataset. It can be supressed by using auto chunks (or auto chunks for time) but that has negative impact on performance:

uds = dfmt.open_partitioned_dataset(file_nc, chunks="auto")

When plotting a single timestep with uds.mesh2d_s1.isel(time=-1).ugrid.plot(), the performance decreases enormously when using auto chunks with large model outputs like 20-partitions DCSM model. How to proceed?

Additional info, this also happens with plain xarray example:

import xarray as xr
file_nc = r"p:\11209231-003-bes-modellering\hydrodynamica\simulations\sss_017\DFM_OUTPUT_sss\sss_0000_map.nc"
uds = xr.open_dataset(file_nc, chunks={"time":1})

Apply filterwarning zoals in xarray pytest (maybe only if chunkstime=1): https://github.com/pydata/xarray/blob/62a4d0f45a4d275c32387522051bbe493414e090/xarray/tests/test_backends.py#L5082

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

Successfully merging a pull request may close this issue.

1 participant