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

Problem when slicing a NEMO 2d grid objects defined with dask chunks. #33

Open
lesommer opened this issue Jun 6, 2016 · 4 comments
Open
Labels

Comments

@lesommer
Copy link
Owner

lesommer commented Jun 6, 2016

a slice of a grid object defined with chunks appears to be disfunctionnal.

eg.

from oocgcm.oceanmodels.nemo import grids
_grd = grids.nemo_2d_grid(...,chunks=xr_chunks)
grd = _grd[500:1500,500:1500]

this works :

gssh = grd.horizontal_gradient(buoyancy)

but this raises an exception

ghb = grd.norm_of_vectorfield(grd.horizontal_gradient(buoyancy))

@lesommer lesommer added the bug label Jun 6, 2016
@lesommer
Copy link
Owner Author

lesommer commented Jun 6, 2016

I have investigated this issue over the last week.

The simplest version of the issue with grid objects can be illustrated when trying to access any array that involved arithmetic operations on dataarrays. one of them is :

grd['cell_area_at_t_location']

It appears that this behavior is related to the default use of lock=False when opening NEMO files.

A short illustration can be found in this notebook

@lesommer
Copy link
Owner Author

lesommer commented Jun 6, 2016

I have added a unit test for testing the validity of grd['cell_area_at_t_location'] when grd is a sliced grid defined with chunks : see this commit

I have changed the default option for creating a xarray.Dataarray commit. We no longer use lock=False as default.

The user can still specify this options as an optional argument.

@lesommer
Copy link
Owner Author

lesommer commented Jun 6, 2016

The test runs successfully on my laptop but it fails on Travis ci.

@lesommer
Copy link
Owner Author

lesommer commented Jun 7, 2016

  • test passes with netcdf4 backend: see
  • test fails with scipy backend : see

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

No branches or pull requests

1 participant