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

PEcAn.DB and PEcAn.meta.analysis cleanup #2351

Closed
wants to merge 30 commits into from

Conversation

ashiklom
Copy link
Member

@ashiklom ashiklom commented May 8, 2019

  • Breaking change: In PEcAn.DB::get.trait.data, if trait.names is NULL or missing, use the traits for which at least one prior is available among the input list of PFTs. (Previously, we were getting this from the PEcAn.utils::trait.dictionary, which we are trying to deprecate remove base/utils/data/trait.dictionary.csv #1747 ).
  • Feature: New function PEcAn.DB::query_priors that is, IMHO, more robust and intuitive than query.priors by leveraging RPostgres prepared statements, providing more informative errors, and handling inputs in a more sophisticated way. Its output should be a perfect superset of query.traits, so I think it should work as a drop-in replacement. Note that a unit test and detailed function documentation are included.
  • Bugfixes and cleanup:
    • Use explicit namespacing (package::function) throughout PEcAn.meta.analysis. Otherwise, many of these functions would fail when trying to run a meta-analysis outside of the PEcAn workflow (i.e. without having loaded the packages first).
    • Documentation and code style cleanup throughout a lot of PEcAn.meta.analysis and PEcAn.DB.

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

ashiklom added 6 commits May 8, 2019 14:25
Because it doesn't require prepared statements and therefore the
"Postgres" driver.
All `PEcAn.DB` tests should start with.

```r
source("db.setup.R")
con <- check_db_test()
```

This helps prevent redundancy in database connection setup, and makes
it easier to accommodate different database configurations in tests
down the line.

Also, note that many of these tests would fail when switching from
`PostgreSQL` to `Postgres` because the latter uses `integer64` for
long integers, while the former uses `double`. These changes force
conversion to numeric in all comparisons.
@tonygardella
Copy link
Contributor

@ashiklom Want me to assign a reviewer on this or do you have someone in mind?

@infotroph
Copy link
Member

@tonygardella @ashiklom I started reviewing #2358, which is a superset of this one, and haven't yet finished. Would it be useful for me to finish reading there and then copy my approval here?

@ashiklom
Copy link
Member Author

Closing this because it has been entirely superceded by #2358 (for which @infotroph gave a detailed and very helpful review -- thanks!).

@ashiklom ashiklom closed this May 28, 2019
@robkooper robkooper mentioned this pull request Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants