sha,message,author_date,committer_date,raw_author,raw_committer,repo,author,committer 9f118624e7924c80fc305f351fa9621d2b58514c,"Surface plots (#5101) * Use broadcast_like for 2d plot coordinates Use broadcast_like if either `x` or `y` inputs are 2d to ensure that both have dimensions in the same order as the DataArray being plotted. Convert to numpy arrays after possibly using broadcast_like. Simplifies code, and fixes #5097 (bug when dimensions have the same size). * Update whats-new * Implement 'surface()' plot function Wraps mpl_toolkits.mplot3d.axes3d.plot_surface * Make surface plots work with facet grids * Unit tests for surface plot * Minor fixes for surface plots * Add surface plots to api.rst and api-hidden.rst * Update whats-new * Fix tests * mypy fix * seaborn doesn't work with matplotlib 3d toolkit * Remove cfdatetime surface plot test Does not work because the datetime.timedelta does not work with surface's 'shading'. * Ignore type checks for mpl_toolkits module * Check matplotlib version is new enough for surface plots * version check requires matplotlib * Handle matplotlib not installed for TestSurface version check * fix flake8 error * Don't run test_plot_transposed_nondim_coord for surface plots Too complicated to check matplotlib version is high enough just for surface plots. * Apply suggestions from code review Co-authored-by: Mathias Hauser * More suggestions from code review * black * isort and flake8 * Make surface plots more backward compatible Following suggestion from Illviljan * Clean up matplotlib requirement * Update xarray/plot/plot.py Co-authored-by: Mathias Hauser * Apply suggestions from code review Co-authored-by: Mathias Hauser * Use None as default value * black * More 2D plotting method examples in docs * Fix docs * [skip-ci] Make example surface plot look a bit nicer Co-authored-by: Mathias Hauser Co-authored-by: Mathias Hauser ",2021-05-03T13:05:02Z,2021-05-03T13:05:02Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 04acabb50bea9f48224464850ae5a918e57406e5,"cumulative_integrate() method (#5153) * Option to have integrate() return a cumulative integral Provides the functionality of scipy.integrate.cumulative_trapezoid. * Update whats-new.rst * Make cumulative integration separate method, not argument to integrate Since the dimensions of the returned arrays are different for cumulative and total integrals, makes more sense for them to be separate methods. * fix docstrings * Mark cumulative_integrate test as requiring scipy",2021-05-01T20:01:31Z,2021-05-01T20:01:31Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 b2351cbe3f3e92f0e242312dae5791fc83a4467a,"Use broadcast_like for 2d plot coordinates (#5099) * Use broadcast_like for 2d plot coordinates Use broadcast_like if either `x` or `y` inputs are 2d to ensure that both have dimensions in the same order as the DataArray being plotted. Convert to numpy arrays after possibly using broadcast_like. Simplifies code, and fixes #5097 (bug when dimensions have the same size). * Update whats-new * Test for issue 5097 * Fix typo in doc/whats-new.rst Co-authored-by: Mathias Hauser * Update doc/whats-new.rst Co-authored-by: Mathias Hauser ",2021-04-22T07:16:16Z,2021-04-22T07:16:16Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 ba47216ec1cd2f170fd85a10f232be7bf3ecc578,"Add Dataset.plot.streamplot() method (#5003) Co-authored-by: keewis ",2021-03-30T16:41:07Z,2021-03-30T16:41:07Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 8cea79823e729e19f79d629fc3ba7c7380bc9342,"Fix docstring for missing_dims argument to isel methods (#4298) ""exception"" was renamed to ""raise"".",2020-08-03T20:23:28Z,2020-08-03T20:23:28Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 bdcfab524ef1c852abe6dabcfabc7292f058fddc,"Support multiple dimensions in DataArray.argmin() and DataArray.argmax() methods (#3936) * DataArray.indices_min() and DataArray.indices_max() methods These return dicts of the indices of the minimum or maximum of a DataArray over several dimensions. * Update whats-new.rst and api.rst with indices_min(), indices_max() * Fix type checking in DataArray._unravel_argminmax() * Fix expected results for TestReduce3D.test_indices_max() * Respect global default for keep_attrs * Merge behaviour of indices_min/indices_max into argmin/argmax When argmin or argmax are called with a sequence for 'dim', they now return a dict with the indices for each dimension in dim. * Basic overload of argmin() and argmax() for Dataset If single dim is passed to Dataset.argmin() or Dataset.argmax(), then pass through to _argmin_base or _argmax_base. If a sequence is passed for dim, raise an exception, because the result for each DataArray would be a dict, which cannot be stored in a Dataset. * Update Variable and dask tests with _argmin_base, _argmax_base The basic numpy-style argmin() and argmax() methods were renamed when adding support for handling multiple dimensions in DataArray.argmin() and DataArray.argmax(). Variable.argmin() and Variable.argmax() are therefore renamed as Variable._argmin_base() and Variable._argmax_base(). * Update api-hidden.rst with _argmin_base and _argmax_base * Explicitly defined class methods override injected methods If a method (such as 'argmin') has been explicitly defined on a class (so that hasattr(cls, ""argmin"")==True), then do not inject that method, as it would override the explicitly defined one. Instead inject a private method, prefixed by ""_injected_"" (such as '_injected_argmin'), so that the injected method is available to the explicitly defined one. Do not perform the hasattr check on binary ops, because this breaks some operations (e.g. addition between DataArray and int in test_dask.py). * Move StringAccessor back to bottom of DataArray class definition * Revert use of _argmin_base and _argmax_base Now not needed because of change to injection in ops.py. * Move implementation of argmin, argmax from DataArray to Variable Makes use of argmin and argmax more general (they are available for Variable) and is straightforward for DataArray to wrap the Variable version. * Update tests for change to coordinates on result of argmin, argmax * Add 'out' keyword to argmin/argmax methods - allow numpy call signature When np.argmin(da) is called, numpy passes an 'out' keyword argument to argmin/argmax. Need to allow this argument to avoid errors (but an exception is thrown if out is not None). * Update and correct docstrings for argmin and argmax * Correct suggested replacement for da.argmin() and da.argmax() * Remove use of _injected_ methods in argmin/argmax * Fix typo in name of argminmax_func Co-Authored-By: keewis * Mark argminmax argument to _unravel_argminmax as a string Co-Authored-By: keewis * Hidden internal methods don't need to appear in docs * Basic docstrings for Dataset.argmin() and Dataset.argmax() * Set stacklevel for DeprecationWarning in argmin/argmax methods * Revert ""Explicitly defined class methods override injected methods"" This reverts commit 8caf2b8d07c14a2956a26b50ee08d83323c36058. * Revert ""Add 'out' keyword to argmin/argmax methods - allow numpy call signature"" This reverts commit ab480b5c88a059264086260e5090eb38b98aa7fa. * Remove argmin and argmax from ops.py * Use self.reduce() in Dataset.argmin() and Dataset.argmax() Replaces need for ""_injected_argmin"" and ""_injected_argmax"". * Whitespace after 'title' lines in docstrings * Remove tests of np.argmax() and np.argmin() functions from test_units.py Applying numpy functions to xarray objects is not necessarily expected to work, and the wrapping of argmin() and argmax() is broken by xarray-specific interface of argmin() and argmax() methods of Variable, DataArray and Dataset. * Clearer deprecation warnings in Dataset.argmin() and Dataset.argmax() Also, previously suggested workaround was not correct. Remove suggestion as there is no workaround (but the removed behaviour is unlikely to be useful). * Add unravel_index to duck_array_ops, use in Variable._unravel_argminmax * Filter argmin/argmax DeprecationWarnings in tests * Correct test for exception for nan in test_argmax * Remove injected argmin and argmax methods from api-hidden.rst * flake8 fixes * Tidy up argmin/argmax following code review Co-authored-by: Deepak Cherian * Remove filters for warnings from argmin/argmax from tests Pass an explicit axis or dim argument instead to avoid the warning. * Swap order of reduce_dims checks in Dataset.reduce() Prefer to pass reduce_dims=None when possible, including for variables with only one dimension. Avoids an error if an 'axis' keyword was passed. * revert the changes to Dataset.reduce * use dim instead of axis * use dimension instead of Ellipsis * Make passing 'dim=...' to Dataset.argmin() or Dataset.argmax() an error * Better docstrings for Dataset.argmin() and Dataset.argmax() * Update doc/whats-new.rst Co-authored-by: keewis Co-authored-by: Stephan Hoyer Co-authored-by: keewis Co-authored-by: Deepak Cherian Co-authored-by: Keewis ",2020-06-29T19:36:24Z,2020-06-29T19:36:24Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 24d755d59421fd0eaf22ad109408275d2bfb8216,"Fix 4009 (#4173) * Test attrs handling in open_mfdataset * Fix attrs handling in open_mfdataset() Need to pass combine_attrs=""drop"", to allow attrs_file to set the attrs. * Update whats-new.rst * Update doc/whats-new.rst Co-authored-by: Deepak Cherian ",2020-06-24T18:22:18Z,2020-06-24T18:22:18Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 9b5140e0711247c373987b56726282140b406d7f,"Add missing_dims argument allowing isel() to ignore missing dimensions (#3923) * Add missing_dims argument allowing isel() to ignore missing dimensions * Add missing_dims to whats-new.rst * Fix typos in TestVariable.test_isel() * Change values for missing_dims argument to {'raise', 'warn', 'ignore'} Matches the possible values used elsewhere for drop_vars arguments. * Add missing_dims argument Dataset.isel() * Mention Dataset.isel in whats-new.rst description of missing_dims",2020-04-03T19:47:07Z,2020-04-03T19:47:07Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 009aa66620b3437cf0de675013fa7d1ff231963c,"Rename ordered_dict_intersection -> compat_dict_intersection (#3887) Do not use OrderedDicts any more, so name did not make sense.",2020-03-24T22:59:06Z,2020-03-24T22:59:06Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 d8bb6204dc6a4bacdfca25b02ba62bb7f1bb5795,"Control attrs of result in `merge()`, `concat()`, `combine_by_coords()` and `combine_nested()` (#3877) * Optionally promote attrs from DataArray to Dataset in to_dataset Adds option 'promote_attrs' to DataArray.to_dataset(). By default promote_attrs=False, maintaining current behaviour. If promote_attrs=True, the attrs of the DataArray are shallow-copied to the Dataset returned by to_dataset(). * utils.ordered_dict_union returns the union of two compatible dicts If the values of any shared key are not equivalent, then raises an error. * combine_attrs argument for merge() Provides several options for how to combine the attributes of the passed objects and give them to the returned Dataset. * combine_attrs argument for concat() Provides several options for how to combine the attributes of the passed objects and give them to the returned DataArray or Dataset. * combine_attrs argument for combine_by_coords() and combine_nested() Provides several options for how to combine the attributes of the passed objects and give them to the returned Dataset. * Add combine_attrs changes to whats-new.rst * Update docstrings to note default values Apply suggestions from code review Co-Authored-By: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> * First argument of update_safety_check and ordered_dict_union not mutable No need for these arguments to be MutableMapping rather than just Mapping. * Rename ordered_dict_union -> compat_dict_union Do not use OrderedDicts any more, so name did not make sense. * Move combine_attrs to v0.16.0 in whats-new.rst * Fix merge of whats-new.rst Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>",2020-03-24T20:40:17Z,2020-03-24T20:40:17Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447 b14eea2f06bbcf1a02c4ae4cba9ed981aef69292,"Fix contourf set under (#3601) * Copy colors for bad, under, and over values in _build_discrete_cmap() Copies the cmap._rgba_bad, cmap._rgba_under, and cmap._rgba_over values to new_cmap, in case they have been set to non-default values. Allows the user to customize plots more by using matplotlib methods on a cmap before passing as an argument to xarray's plotting methods. Previously these settings were overridden by defaults when creating the cmap actually used to make the plot. * Tests that cmap.set_bad, cmap.set_under, cmap.set_over not overridden * Add defaults in case cmap is a str in _build_discrete_cmap If the input cmap is a str, getting _rgba_bad, _rgba_under, or _rgba_over attributes from it will fail. To fix this, provide defaults taken from new_cmap. * Consolidate tests of cmap.set_bad() cmap.set_under() and cmap.set_over() Make one unit test test all three properties, rather than having a separate test for each. * Do not read/modify private members for bad, under and over colors * Only change under, over colors if they were set by user When modifying a colormap, we only want to preserve the under and over colors of the original colormap if they were explicitly set by the user. In _build_discrete_cmap this makes no difference, as the new_cmap returned by mpl.colors.from_levels_and_colors has the same minimum and maximum colors as its input, so the default under and over colors would not change anyway and could be copied regardless. However, for clarity and in case the same pattern is needed in future elsewhere, it is nicer to add a checks for: whether the under color is the same as cmap(0), only setting under for new_cmap if it is not; and whether the over color is the same as cmap(cmap.N - 1), only setting over for new_cmap if it is not. * Remove temporary variable that is only used once * Use deepcopy instead of copy for cmaps cmaps contain tuples member variables, so safer to deepcopy instead of just copy to make sure we never change the copied variable. * Set different colors for bad, under and over when testing * Extra test checking bad, under and over colors when not set explicitly * Comment on why test uses deepcopy * Pass vmin and vmax in test_contourf_cmap_set() Set vmin and vmax so that _build_discrete_colormap is called with extend='both'. extend is passed to mpl.colors.from_levels_and_colors(), which returns a result with sensible under and over values if extend='both', but not if extend='neither' (but if extend='neither' the under and over values would not be used because the data would all be within the plotted range) * Don't use private members in tests * Add whats-new * Fix isort * Update doc/whats-new.rst Co-authored-by: Deepak Cherian ",2020-02-24T20:20:07Z,2020-02-24T20:20:07Z,7e21ec85163297602c88c6fc49638c2c95b296a9,cd792325681cbad9f663f2879d8b69f1edbb678f,13221727,3958036,19864447