Skip to content

Commit

Permalink
Add FAQs page to docs (#181)
Browse files Browse the repository at this point in the history
- Add section for handling opening files with conflicting data var values
  • Loading branch information
tomvothecoder authored Jan 10, 2022
1 parent 5d2dda1 commit 35b77f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/faqs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
==========================
Frequently Asked Questions
==========================

How do I open files that have conflicting values for a data variable(s)?
------------------------------------------------------------------------
In xarray, the default setting for checking compatibility across files is ``compat='no_conflicts'``.
If conflicting values for a data variable exists between the files, xarray raises ``MergeError: conflicting values for variable <DATA VAR NAME> on objects to be combined. You can skip this check by specifying compat="override".``

Let's say you try opening two files using ``xcdat.open_mfdataset()`` and the aforementioned ``MergeError`` appears for the ``lat_bnds`` data var.
You perform floating point comparison for ``lat_bnds`` and find a very small difference at specific coordinates.

To workaround this data quality issue and proceed with opening the files, pass these keyword arguments:

1. ``compat="override"``: skip comparing and pick variable from first dataset
2. ``join="override"``: if indexes are of same size, rewrite indexes to be those of the first object with that dimension. Indexes for the same dimension must have the same size in all objects.

- ``join`` is set to `"outer_join"` by default, which might not be desired.

``xcdat.open_mfdataset('path/to/files/*.nc', compat="override", join="override")``

More information here: https://xarray.pydata.org/en/stable/generated/xarray.open_mfdataset.html#xarray-open-mfdataset
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ See `LICENSE <LICENSE>`_ for details
Getting Started <getting_started>
API Reference <api>
Xarray API Reference <https://xarray.pydata.org/en/stable/api.html>
Frequently Asked Questions <faqs>

.. toctree::
:maxdepth: 2
Expand Down

0 comments on commit 35b77f2

Please sign in to comment.