-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add section for handling opening files with conflicting data var values
- Loading branch information
1 parent
5d2dda1
commit 35b77f2
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters