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

roi fails on [1,N] or [N,1] 2D masks #142

Open
laurensstoop opened this issue Feb 14, 2019 · 0 comments
Open

roi fails on [1,N] or [N,1] 2D masks #142

laurensstoop opened this issue Feb 14, 2019 · 0 comments

Comments

@laurensstoop
Copy link

Hi @fmaussion,

The ds_country.salem.roi(shape=country_shape) fails if the mask is [1,N] or [N,1].

Specifically I have mask on very course data that makes from switzerland a set of 3 boxes on the same latitude.

The traceback made me realise that it fails in sio.py at the def _salem_grid_from_dataset(ds): function.
The lines are

` # OK, get it
x = ds.variables[x][:]
y = ds.variables[y][:]

# Make the grid
dx = x[1]-x[0]  ### THIS DOESN'T WORK FOR 1D
dy = y[1]-y[0]  ### SAME
args = dict(nxny=(x.shape[0], y.shape[0]), proj=proj, dxdy=(dx, dy),
            x0y0=(x[0], y[0]))
return gis.Grid(**args)`

At the moment I bodged the info I needed from a different mask, so I can't help with a fool-proof solution.

~Laurens

@laurensstoop laurensstoop changed the title Fails on 1D masks Fails on [1,N] or [N,1] 2D masks Feb 14, 2019
@laurensstoop laurensstoop changed the title Fails on [1,N] or [N,1] 2D masks roi fails on [1,N] or [N,1] 2D masks Feb 14, 2019
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

1 participant