ArgoCanada / argoFloats

Tools for analyzing collections of oceanographic Argo floats
https://argocanada.github.io/argoFloats/index.html
17 stars 7 forks source link

Adding age="latest" argument to getProfiles #573

Closed j-harbin closed 2 years ago

j-harbin commented 2 years ago

This pull request is for issue 558, which was to develop an age="latest" argument for getProfiles.

The way I approached this was if getProfiles(age="latest"), files were downloaded if:

  1. the file doesn't already OR
  2. The file does exist and the date it was created is OLDER than the date_update in the index

Otherwise they were skipped.

skipDownload (already defined in downLoadedWithRetries() ) is then assigned to be anything that is not downloaded based on the two cases above. Documentation and debugging has also been update to indicate the changes as well.

Please note that when doing a "Check", I do receive 1 ERROR and 1 WARNING shown below. This is not specific to this branch. I also get the same result with the develop branch and this has happened since updating my RStudio (at least when I started noticing it).

Screen Shot 2022-05-25 at 2 53 28 PM

dankelley commented 2 years ago

any chance of a Z so we can figure out the error?

codecov[bot] commented 2 years ago

Codecov Report

Merging #573 (b32f248) into develop (353fb63) will decrease coverage by 0.43%. The diff coverage is 25.00%.

@@             Coverage Diff             @@
##           develop     #573      +/-   ##
===========================================
- Coverage    56.60%   56.17%   -0.44%     
===========================================
  Files           15       15              
  Lines         2028     2049      +21     
===========================================
+ Hits          1148     1151       +3     
- Misses         880      898      +18     
Impacted Files Coverage Δ
R/get.R 57.45% <15.00%> (-4.27%) :arrow_down:
R/download.R 88.63% <75.00%> (-0.90%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d2f0132...b32f248. Read the comment docs.

dankelley commented 2 years ago

Why is <<- being used in the new code?

j-harbin commented 2 years ago

The double binding, which I'll admit I wasn't sure if it was allowed, is because the latest argument is passed to getProfiles (code found in get.R), but the information is needed for downloadWithRetries (code found in download.R) to indicate which files to skip the download for.

dankelley commented 2 years ago

Hm, let me look. The "R way" is not to use <<- unless really, really necessary. That's why I get the message when I do build/check (and I'm worried that such a message would cause CRAN rejection). I'll take a look at this before our 1000h meeting today.

dankelley commented 2 years ago

I think I see a solution. Possibly we could start our 1000h meeting a bit early, so you and I can discuss?