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

CRAN failures related to fetchHenry() and waterDayYear() #333

Closed
brownag opened this issue Jan 2, 2024 · 2 comments
Closed

CRAN failures related to fetchHenry() and waterDayYear() #333

brownag opened this issue Jan 2, 2024 · 2 comments
Assignees
Labels

Comments

@brownag
Copy link
Member

brownag commented Jan 2, 2024

fetchHenry() and waterDayYear() are failing tests due to slight offsets in the expected values. I will need to resubmit the package within two weeks, so unless there is an obvious fix I will likely skip these tests on CRAN going forward to prevent minor issues like this causing problems for the package as a whole.

Possibly related prior issues:

Version: 2.8.0
Check: tests
Result: ERROR 
    Running ‘testthat.R’ [17s/26s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(soilDB)
    > 
    > test_check("soilDB")
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    
    ══ Skipped tests (83) ══════════════════════════════════════════════════════════
    • On CRAN (76): 'test-ISSR800.R:5:3', 'test-ISSR800.R:42:3',
      'test-OSDquery.R:5:3', 'test-OSDquery.R:30:3', 'test-ROSETTA.R:42:3',
      'test-ROSETTA.R:65:3', 'test-ROSETTA.R:88:3', 'test-SDA_query.R:6:3',
      'test-SDA_query.R:42:3', 'test-SDA_query.R:68:3', 'test-SDA_query.R:88:3',
      'test-SDA_query.R:120:3', 'test-SDA_query.R:158:3', 'test-SDA_query.R:180:3',
      'test-SDA_query.R:198:3', 'test-SDA_query.R:219:3',
      'test-SoilDataViewer.R:2:3', 'test-fetchEDIT_tools.R:37:3',
      'test-fetchKSSL.R:5:3', 'test-fetchKSSL.R:24:3', 'test-fetchKSSL.R:57:3',
      'test-fetchKSSL.R:75:3', 'test-fetchKSSL.R:92:3', 'test-fetchKSSL.R:107:3',
      'test-fetchKSSL.R:121:3', 'test-fetchKSSL.R:155:3', 'test-fetchLDM.R:3:3',
      'test-fetchNASIS.R:103:3', 'test-fetchNASISWebReport.R:6:3',
      'test-fetchNASISWebReport.R:27:3', 'test-fetchNASISWebReport.R:44:3',
      'test-fetchNASISWebReport.R:63:3', 'test-fetchNASISWebReport.R:80:3',
      'test-fetchOSD.R:9:3', 'test-fetchOSD.R:32:3', 'test-fetchOSD.R:46:3',
      'test-fetchOSD.R:63:3', 'test-fetchOSD.R:81:3', 'test-fetchOSD.R:98:3',
      'test-fetchSCAN.R:7:3', 'test-fetchSCAN.R:27:3',
      'test-fetchSDA_component.R:8:3', 'test-fetchSDA_component.R:23:3',
      'test-fetchSDA_component.R:35:3', 'test-fetchSDA_component.R:53:3',
      'test-fetchSDA_spatial.R:5:3', 'test-fetchSDA_spatial.R:32:3',
      'test-fetchSRI.R:3:3', 'test-fetchSRI.R:29:3', 'test-fetchSoilGrids.R:5:3',
      'test-get_OSD.R:7:3', 'test-get_OSD.R:33:3', 'test-get_SDA_coecoclass.R:2:3',
      'test-get_SDA_cosurfmorph.R:3:3', 'test-get_SDA_hydric.R:3:3',
      'test-get_SDA_interpretation.R:8:3', 'test-get_SDA_interpretation.R:23:3',
      'test-get_SDA_interpretation.R:41:3', 'test-get_SDA_interpretation.R:59:3',
      'test-get_SDA_muaggatt.R:2:3', 'test-get_SDA_pmgroupname.R:2:3',
      'test-get_SDA_property.R:16:3', 'test-get_SDA_property.R:42:3',
      'test-get_SDA_property.R:59:3', 'test-get_SDA_property.R:97:3',
      'test-get_SDA_property.R:223:3', 'test-get_SDA_property.R:261:3',
      'test-get_SSURGO_utils.R:2:3', 'test-mukey-WCS.R:6:3',
      'test-seriesExtent.R:3:3', 'test-siblings.R:6:3', 'test-siblings.R:29:3',
      'test-siblings.R:43:3', 'test-soilDBdata.R:3:3', 'test-waterDayYear.R:75:3',
      'test-waterDayYear.R:91:3'
    • local NASIS database not available (7): 'test-dbQueryNASIS.R:6:5',
      'test-fetchNASIS.R:51:5', 'test-fetchNASIS.R:85:5',
      'test-fetchNASIS.R:127:5', 'test-fetchNASIS.R:134:5',
      'test-fetchNASIS.R:141:5', 'test-fetchNASISLabData.R:27:5'
    
    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Failure ('test-fetchHenry.R:142:3'): summarizeSoilTemperature() works as expected ──
    res$Winter not equal to 6.16.
    1/1 mismatches
    [1] 6.12 - 6.16 == -0.04
    ── Failure ('test-fetchHenry.R:144:3'): summarizeSoilTemperature() works as expected ──
    res$Summer not equal to 16.92.
    1/1 mismatches
    [1] 17 - 16.9 == 0.06
    ── Failure ('test-waterDayYear.R:24:3'): works as expected ─────────────────────
    res$wy not equal to 2019.
    1/1 mismatches
    [1] 2018 - 2019 == -1
    ── Failure ('test-waterDayYear.R:25:3'): works as expected ─────────────────────
    res$wd not equal to 1.
    1/1 mismatches
    [1] 366 - 1 == 365
    
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    Error: Test failures
    Execution halted
Flavor: [r-devel-linux-x86_64-debian-gcc](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/soilDB-00check.html)

Version: 2.8.0
Check: tests
Result: ERROR 
    Running ‘testthat.R’ [23s/22s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(soilDB)
    > 
    > test_check("soilDB")
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    
    ══ Skipped tests (83) ══════════════════════════════════════════════════════════
    • On CRAN (76): 'test-ISSR800.R:5:3', 'test-ISSR800.R:42:3',
      'test-OSDquery.R:5:3', 'test-OSDquery.R:30:3', 'test-ROSETTA.R:42:3',
      'test-ROSETTA.R:65:3', 'test-ROSETTA.R:88:3', 'test-SDA_query.R:6:3',
      'test-SDA_query.R:42:3', 'test-SDA_query.R:68:3', 'test-SDA_query.R:88:3',
      'test-SDA_query.R:120:3', 'test-SDA_query.R:158:3', 'test-SDA_query.R:180:3',
      'test-SDA_query.R:198:3', 'test-SDA_query.R:219:3',
      'test-SoilDataViewer.R:2:3', 'test-fetchEDIT_tools.R:37:3',
      'test-fetchKSSL.R:5:3', 'test-fetchKSSL.R:24:3', 'test-fetchKSSL.R:57:3',
      'test-fetchKSSL.R:75:3', 'test-fetchKSSL.R:92:3', 'test-fetchKSSL.R:107:3',
      'test-fetchKSSL.R:121:3', 'test-fetchKSSL.R:155:3', 'test-fetchLDM.R:3:3',
      'test-fetchNASIS.R:103:3', 'test-fetchNASISWebReport.R:6:3',
      'test-fetchNASISWebReport.R:27:3', 'test-fetchNASISWebReport.R:44:3',
      'test-fetchNASISWebReport.R:63:3', 'test-fetchNASISWebReport.R:80:3',
      'test-fetchOSD.R:9:3', 'test-fetchOSD.R:32:3', 'test-fetchOSD.R:46:3',
      'test-fetchOSD.R:63:3', 'test-fetchOSD.R:81:3', 'test-fetchOSD.R:98:3',
      'test-fetchSCAN.R:7:3', 'test-fetchSCAN.R:27:3',
      'test-fetchSDA_component.R:8:3', 'test-fetchSDA_component.R:23:3',
      'test-fetchSDA_component.R:35:3', 'test-fetchSDA_component.R:53:3',
      'test-fetchSDA_spatial.R:5:3', 'test-fetchSDA_spatial.R:32:3',
      'test-fetchSRI.R:3:3', 'test-fetchSRI.R:29:3', 'test-fetchSoilGrids.R:5:3',
      'test-get_OSD.R:7:3', 'test-get_OSD.R:33:3', 'test-get_SDA_coecoclass.R:2:3',
      'test-get_SDA_cosurfmorph.R:3:3', 'test-get_SDA_hydric.R:3:3',
      'test-get_SDA_interpretation.R:8:3', 'test-get_SDA_interpretation.R:23:3',
      'test-get_SDA_interpretation.R:41:3', 'test-get_SDA_interpretation.R:59:3',
      'test-get_SDA_muaggatt.R:2:3', 'test-get_SDA_pmgroupname.R:2:3',
      'test-get_SDA_property.R:16:3', 'test-get_SDA_property.R:42:3',
      'test-get_SDA_property.R:59:3', 'test-get_SDA_property.R:97:3',
      'test-get_SDA_property.R:223:3', 'test-get_SDA_property.R:261:3',
      'test-get_SSURGO_utils.R:2:3', 'test-mukey-WCS.R:6:3',
      'test-seriesExtent.R:3:3', 'test-siblings.R:6:3', 'test-siblings.R:29:3',
      'test-siblings.R:43:3', 'test-soilDBdata.R:3:3', 'test-waterDayYear.R:75:3',
      'test-waterDayYear.R:91:3'
    • local NASIS database not available (7): 'test-dbQueryNASIS.R:6:5',
      'test-fetchNASIS.R:51:5', 'test-fetchNASIS.R:85:5',
      'test-fetchNASIS.R:127:5', 'test-fetchNASIS.R:134:5',
      'test-fetchNASIS.R:141:5', 'test-fetchNASISLabData.R:27:5'
    
    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Failure ('test-fetchHenry.R:142:3'): summarizeSoilTemperature() works as expected ──
    res$Winter not equal to 6.16.
    1/1 mismatches
    [1] 6.12 - 6.16 == -0.04
    ── Failure ('test-fetchHenry.R:144:3'): summarizeSoilTemperature() works as expected ──
    res$Summer not equal to 16.92.
    1/1 mismatches
    [1] 17 - 16.9 == 0.06
    ── Failure ('test-waterDayYear.R:24:3'): works as expected ─────────────────────
    res$wy not equal to 2019.
    1/1 mismatches
    [1] 2018 - 2019 == -1
    ── Failure ('test-waterDayYear.R:25:3'): works as expected ─────────────────────
    res$wd not equal to 1.
    1/1 mismatches
    [1] 366 - 1 == 365
    
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    Error: Test failures
    Execution halted
Flavor: [r-devel-linux-x86_64-fedora-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/soilDB-00check.html)

Version: 2.8.0
Check: tests
Result: ERROR 
    Running ‘testthat.R’ [37s/38s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > library(testthat)
    > library(soilDB)
    > 
    > test_check("soilDB")
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    
    ══ Skipped tests (83) ══════════════════════════════════════════════════════════
    • On CRAN (76): 'test-ISSR800.R:5:3', 'test-ISSR800.R:42:3',
      'test-OSDquery.R:5:3', 'test-OSDquery.R:30:3', 'test-ROSETTA.R:42:3',
      'test-ROSETTA.R:65:3', 'test-ROSETTA.R:88:3', 'test-SDA_query.R:6:3',
      'test-SDA_query.R:42:3', 'test-SDA_query.R:68:3', 'test-SDA_query.R:88:3',
      'test-SDA_query.R:120:3', 'test-SDA_query.R:158:3', 'test-SDA_query.R:180:3',
      'test-SDA_query.R:198:3', 'test-SDA_query.R:219:3',
      'test-SoilDataViewer.R:2:3', 'test-fetchEDIT_tools.R:37:3',
      'test-fetchKSSL.R:5:3', 'test-fetchKSSL.R:24:3', 'test-fetchKSSL.R:57:3',
      'test-fetchKSSL.R:75:3', 'test-fetchKSSL.R:92:3', 'test-fetchKSSL.R:107:3',
      'test-fetchKSSL.R:121:3', 'test-fetchKSSL.R:155:3', 'test-fetchLDM.R:3:3',
      'test-fetchNASIS.R:103:3', 'test-fetchNASISWebReport.R:6:3',
      'test-fetchNASISWebReport.R:27:3', 'test-fetchNASISWebReport.R:44:3',
      'test-fetchNASISWebReport.R:63:3', 'test-fetchNASISWebReport.R:80:3',
      'test-fetchOSD.R:9:3', 'test-fetchOSD.R:32:3', 'test-fetchOSD.R:46:3',
      'test-fetchOSD.R:63:3', 'test-fetchOSD.R:81:3', 'test-fetchOSD.R:98:3',
      'test-fetchSCAN.R:7:3', 'test-fetchSCAN.R:27:3',
      'test-fetchSDA_component.R:8:3', 'test-fetchSDA_component.R:23:3',
      'test-fetchSDA_component.R:35:3', 'test-fetchSDA_component.R:53:3',
      'test-fetchSDA_spatial.R:5:3', 'test-fetchSDA_spatial.R:32:3',
      'test-fetchSRI.R:3:3', 'test-fetchSRI.R:29:3', 'test-fetchSoilGrids.R:5:3',
      'test-get_OSD.R:7:3', 'test-get_OSD.R:33:3', 'test-get_SDA_coecoclass.R:2:3',
      'test-get_SDA_cosurfmorph.R:3:3', 'test-get_SDA_hydric.R:3:3',
      'test-get_SDA_interpretation.R:8:3', 'test-get_SDA_interpretation.R:23:3',
      'test-get_SDA_interpretation.R:41:3', 'test-get_SDA_interpretation.R:59:3',
      'test-get_SDA_muaggatt.R:2:3', 'test-get_SDA_pmgroupname.R:2:3',
      'test-get_SDA_property.R:16:3', 'test-get_SDA_property.R:42:3',
      'test-get_SDA_property.R:59:3', 'test-get_SDA_property.R:97:3',
      'test-get_SDA_property.R:223:3', 'test-get_SDA_property.R:261:3',
      'test-get_SSURGO_utils.R:2:3', 'test-mukey-WCS.R:6:3',
      'test-seriesExtent.R:3:3', 'test-siblings.R:6:3', 'test-siblings.R:29:3',
      'test-siblings.R:43:3', 'test-soilDBdata.R:3:3', 'test-waterDayYear.R:75:3',
      'test-waterDayYear.R:91:3'
    • local NASIS database not available (7): 'test-dbQueryNASIS.R:6:5',
      'test-fetchNASIS.R:51:5', 'test-fetchNASIS.R:85:5',
      'test-fetchNASIS.R:127:5', 'test-fetchNASIS.R:134:5',
      'test-fetchNASIS.R:141:5', 'test-fetchNASISLabData.R:27:5'
    
    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Failure ('test-fetchHenry.R:142:3'): summarizeSoilTemperature() works as expected ──
    res$Winter not equal to 6.16.
    1/1 mismatches
    [1] 6.12 - 6.16 == -0.04
    ── Failure ('test-fetchHenry.R:144:3'): summarizeSoilTemperature() works as expected ──
    res$Summer not equal to 16.92.
    1/1 mismatches
    [1] 17 - 16.9 == 0.06
    ── Failure ('test-waterDayYear.R:24:3'): works as expected ─────────────────────
    res$wy not equal to 2019.
    1/1 mismatches
    [1] 2018 - 2019 == -1
    ── Failure ('test-waterDayYear.R:25:3'): works as expected ─────────────────────
    res$wd not equal to 1.
    1/1 mismatches
    [1] 366 - 1 == 365
    
    [ FAIL 4 | WARN 0 | SKIP 83 | PASS 216 ]
    Error: Test failures
    Execution halted
Flavor: [r-devel-linux-x86_64-fedora-gcc](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-gcc/soilDB-00check.html)
@brownag brownag self-assigned this Jan 2, 2024
@brownag brownag added the bug label Jan 2, 2024
brownag added a commit that referenced this issue Jan 2, 2024
 - ensure starting julian day is calculated in the correct year (previously used only month and day)
brownag added a commit that referenced this issue Jan 2, 2024
 - use the correct year when creating dates from julian days
@brownag
Copy link
Member Author

brownag commented Jan 2, 2024

Turns out it was a fairly simple fix. The same type of problem in both functions: creating dates in the current year rather than in the target year sometimes leads to offsets in julian days due to leap years. This error cropped up right on 2024-01-01.

This means that the values returned by summarizeSoilTemperature() have been, up until this point, slightly dependent on the year in which they are calculated (regardless of the input data). Now the year is derived from the input data, so it should be stable across years. Tthe expected values for winter and summer temperature have been updated (change in the hundreths place) and tolerance added. The tests are all now skipped on CRAN.

@brownag brownag closed this as completed Jan 2, 2024
@dylanbeaudette
Copy link
Member

Nice catch! Thanks for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants