Skip to content
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

Add FAQs page to docs #181

Merged
merged 4 commits into from
Jan 10, 2022
Merged

Add FAQs page to docs #181

merged 4 commits into from
Jan 10, 2022

Conversation

tomvothecoder
Copy link
Collaborator

@tomvothecoder tomvothecoder commented Jan 10, 2022

Description

This PR adds a page to the documentation for FAQs. It also adds a section to the FAQs for handling #162.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

If applicable:

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass with my changes (locally and CI/CD build)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have noted that this is a breaking change for a major release (fix or feature that would cause existing functionality to not work as expected)

- Add section for handling opening files with conflicting data var values
@tomvothecoder tomvothecoder added type: docs Updates to documentation Priority: Medium labels Jan 10, 2022
@tomvothecoder tomvothecoder self-assigned this Jan 10, 2022
docs/faqs.rst Outdated Show resolved Hide resolved
docs/faqs.rst Outdated Show resolved Hide resolved
Comment on lines +1 to +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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pochedls Just an FYI

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - thanks Tom!

@tomvothecoder tomvothecoder merged commit 35b77f2 into main Jan 10, 2022
@tomvothecoder tomvothecoder deleted the docs/162-conflicting-bnds branch January 10, 2022 23:26
@tomvothecoder tomvothecoder restored the docs/162-conflicting-bnds branch January 10, 2022 23:33
@tomvothecoder tomvothecoder deleted the docs/162-conflicting-bnds branch January 10, 2022 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs Updates to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

conflicting values for variable 'lat_bnds'
2 participants