Skip to content

Commit

Permalink
try to unpin sphinx version
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Oct 26, 2016
1 parent 9c5321c commit 3a59ba6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- descartes
- numpydoc
- ipython=4.0.1
- sphinx=1.2.3 # pin to avoid https://github.com/sphinx-doc/sphinx/issues/1822
- sphinx
- pip:
- git+https://github.com/fmaussion/motionless.git
- sphinx-gallery
7 changes: 7 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ What's New
v0.1.1 (Unreleased)
-------------------

Enhancements
~~~~~~~~~~~~

- General documentation enhancements
- New ``ds`` keyword to the accessors ``subset()`` and ``roi()`` methods

Bug fixes
~~~~~~~~~

- Remove use to deprecated ``rasterio.drivers()``
- GeoNetCDF files without time variable should now open without error


Expand Down
8 changes: 7 additions & 1 deletion salem/sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def subset(self, margin=0, ds=None, **kwargs):
]
return out_ds

def roi(self, **kwargs):
def roi(self, ds=None, **kwargs):
"""roi(self, shape=None, geometry=None, grid=None, corners=None,
crs=wgs84, roi=None)
Expand All @@ -454,6 +454,8 @@ def roi(self, **kwargs):
Parameters
----------
ds : Dataset or DataArray
form the ROI from the extent of the Dataset or DataArray
shape : str
path to a shapefile
geometry : geometry
Expand All @@ -469,6 +471,10 @@ def roi(self, **kwargs):
if you have a mask ready, you can give it here
"""

if ds is not None:
grid = ds.salem.grid
kwargs.setdefault('grid', grid)

mask = self.grid.region_of_interest(**kwargs)
coords = {self.y_dim: self._obj[self.y_dim].values,
self.x_dim: self._obj[self.x_dim].values}
Expand Down
3 changes: 3 additions & 0 deletions salem/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ def test_era(self):
self.assertEqual(ds.salem.x_dim, 'longitude')
self.assertEqual(ds.salem.y_dim, 'latitude')

dss = ds.salem.subset(ds=ds)
self.assertEqual(dss.salem.grid, ds.salem.grid)

lon = 91.1
lat = 31.1
dss = ds.salem.subset(corners=((lon, lat), (lon, lat)), margin=1)
Expand Down

0 comments on commit 3a59ba6

Please sign in to comment.