Skip to content

vélin #4872

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

Merged
merged 5 commits into from
Feb 7, 2021
Merged

vélin #4872

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -24,6 +24,11 @@ repos:
rev: 3.8.4
hooks:
- id: flake8
# - repo: https://github.com/Carreau/velin
# rev: 0.0.8
# hooks:
# - id: velin
# args: ["--write", "--compact"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790 # Must match ci/requirements/*.yml
hooks:
2 changes: 1 addition & 1 deletion xarray/backends/locks.py
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ def _get_scheduler(get=None, collection=None) -> Optional[str]:
None is returned if no dask scheduler is active.
See also
See Also
--------
dask.base.get_scheduler
"""
2 changes: 1 addition & 1 deletion xarray/backends/lru_cache.py
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ def __init__(self, maxsize: int, on_evict: Callable[[K, V], Any] = None):
----------
maxsize : int
Integer maximum number of items to hold in the cache.
on_evict: callable, optional
on_evict : callable, optional
Function to call like ``on_evict(key, value)`` when items are
evicted.
"""
9 changes: 4 additions & 5 deletions xarray/backends/rasterio_.py
Original file line number Diff line number Diff line change
@@ -52,9 +52,9 @@ def shape(self):
def _get_indexer(self, key):
"""Get indexer for rasterio array.
Parameter
---------
key: tuple of int
Parameters
----------
key : tuple of int
Returns
-------
@@ -63,7 +63,7 @@ def _get_indexer(self, key):
squeeze_axis: axes to be squeezed
np_ind: indexer for loaded numpy array
See also
See Also
--------
indexing.decompose_indexer
"""
@@ -180,7 +180,6 @@ def open_rasterio(filename, parse_coordinates=None, chunks=None, cache=None, loc
nx, ny = da.sizes['x'], da.sizes['y']
x, y = np.meshgrid(np.arange(nx)+0.5, np.arange(ny)+0.5) * transform
Parameters
----------
filename : str, rasterio.DatasetReader, or rasterio.WarpedVRT
6 changes: 3 additions & 3 deletions xarray/backends/zarr.py
Original file line number Diff line number Diff line change
@@ -462,7 +462,7 @@ def set_variables(self, variables, check_encoding_set, writer, unlimited_dims=No
check_encoding_set : list-like
List of variables that should be checked for invalid encoding
values
writer :
writer
unlimited_dims : list-like
List of dimension names that should be treated as unlimited
dimensions.
@@ -566,7 +566,7 @@ def open_zarr(
based on the variable's zarr chunks. If `chunks=None`, zarr array
data will lazily convert to numpy arrays upon access. This accepts
all the chunk specifications as Dask does.
overwrite_encoded_chunks: bool, optional
overwrite_encoded_chunks : bool, optional
Whether to drop the zarr chunks encoded for each variable when a
dataset is loaded with specified chunk sizes (default: False)
decode_cf : bool, optional
@@ -605,7 +605,7 @@ def open_zarr(
{'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds'}
into timedelta objects. If False, leave them encoded as numbers.
If None (default), assume the same value of decode_time.
use_cftime: bool, optional
use_cftime : bool, optional
Only relevant if encoded dates come from a standard calendar
(e.g. "gregorian", "proleptic_gregorian", "standard", or not
specified). If None (default), attempt to decode times to
5 changes: 1 addition & 4 deletions xarray/coding/cftime_offsets.py
Original file line number Diff line number Diff line change
@@ -796,7 +796,7 @@ def cftime_range(
periods : int, optional
Number of periods to generate.
freq : str or None, default: "D"
Frequency strings can have multiples, e.g. "5H".
Frequency strings can have multiples, e.g. "5H".
normalize : bool, default: False
Normalize start/end dates to midnight before generating date range.
name : str, default: None
@@ -813,7 +813,6 @@ def cftime_range(
Notes
-----
This function is an analog of ``pandas.date_range`` for use in generating
sequences of ``cftime.datetime`` objects. It supports most of the
features of ``pandas.date_range`` (e.g. specifying how the index is
@@ -911,7 +910,6 @@ def cftime_range(
| Q(S)-DEC | Quarter frequency, anchored at the end (or beginning) of December |
+----------+--------------------------------------------------------------------+
Finally, the following calendar aliases are supported.
+--------------------------------+---------------------------------------+
@@ -932,7 +930,6 @@ def cftime_range(
Examples
--------
This function returns a ``CFTimeIndex``, populated with ``cftime.datetime``
objects associated with the specified calendar type, e.g.
2 changes: 1 addition & 1 deletion xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
@@ -516,7 +516,7 @@ def shift(self, n, freq):
-------
CFTimeIndex
See also
See Also
--------
pandas.DatetimeIndex.shift
4 changes: 2 additions & 2 deletions xarray/coding/frequencies.py
Original file line number Diff line number Diff line change
@@ -62,8 +62,8 @@ def infer_freq(index):
Parameters
----------
index : CFTimeIndex, DataArray, DatetimeIndex, TimedeltaIndex, Series
If not passed a CFTimeIndex, this simply calls `pandas.infer_freq`.
If passed a Series or a DataArray will use the values of the series (NOT THE INDEX).
If not passed a CFTimeIndex, this simply calls `pandas.infer_freq`.
If passed a Series or a DataArray will use the values of the series (NOT THE INDEX).
Returns
-------
4 changes: 2 additions & 2 deletions xarray/coding/times.py
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ def decode_cf_datetime(num_dates, units, calendar=None, use_cftime=None):
Note that time unit in `units` must not be smaller than microseconds and
not larger than days.
See also
See Also
--------
cftime.num2date
"""
@@ -407,7 +407,7 @@ def encode_cf_datetime(dates, units=None, calendar=None):
Unlike `date2num`, this function can handle datetime64 arrays.
See also
See Also
--------
cftime.date2num
"""
7 changes: 3 additions & 4 deletions xarray/conventions.py
Original file line number Diff line number Diff line change
@@ -624,7 +624,7 @@ def cf_decoder(
concat_characters : bool
Should character arrays be concatenated to strings, for
example: ["h", "e", "l", "l", "o"] -> "hello"
mask_and_scale: bool
mask_and_scale : bool
Lazily scale (using scale_factor and add_offset) and mask
(using _FillValue).
decode_times : bool
@@ -637,7 +637,7 @@ def cf_decoder(
decoded_attributes : dict
A dictionary mapping from attribute name to values.
See also
See Also
--------
decode_cf_variable
"""
@@ -747,7 +747,6 @@ def cf_encoder(variables, attributes):
This includes masking, scaling, character array handling,
and CF-time encoding.
Parameters
----------
variables : dict
@@ -762,7 +761,7 @@ def cf_encoder(variables, attributes):
encoded_attributes : dict
A dictionary mapping from attribute name to value
See also
See Also
--------
decode_cf_variable, encode_cf_variable
"""
4 changes: 2 additions & 2 deletions xarray/core/accessor_dt.py
Original file line number Diff line number Diff line change
@@ -322,8 +322,8 @@ def strftime(self, date_format):
def isocalendar(self):
"""Dataset containing ISO year, week number, and weekday.
Note
----
Notes
-----
The iso year and weekday differ from the nominal year and weekday.
"""

4 changes: 1 addition & 3 deletions xarray/core/alignment.py
Original file line number Diff line number Diff line change
@@ -135,7 +135,6 @@ def align(
Examples
--------
>>> import xarray as xr
>>> x = xr.DataArray(
... [[25, 35], [10, 24]],
@@ -532,7 +531,7 @@ def reindex_variables(
the input. In either case, new xarray objects are always returned.
fill_value : scalar, optional
Value to use for newly missing values
sparse: bool, optional
sparse : bool, optional
Use an sparse-array
Returns
@@ -704,7 +703,6 @@ def broadcast(*args, exclude=None):
Examples
--------
Broadcast two data arrays against one another to fill out their dimensions:
>>> a = xr.DataArray([1, 2, 3], dims="x")
Loading