Skip to content

Commit

Permalink
Use Downloads.download
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc committed May 17, 2024
1 parent 39fbc9d commit 3c8e143
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/AO.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module AO

using DataDeps # For storage location of data
using Downloads

function fallback_download(remotepath, localdir)
@assert(isdir(localdir))
filename = basename(remotepath) # only works for URLs with filename as last part of name
localpath = joinpath(localdir, filename)
Base.download(remotepath, localpath)
Downloads.download(remotepath, localpath)
return localpath
end

Expand Down Expand Up @@ -48,14 +49,14 @@ function download_and_unpack()
(in shell mode) to check its contents.
Please check with Seth John (sethjohn@usc.edu) for references
Please check with Seth John (sethjohn@usc.edu) for references
to cite if you use the other data contained in the AO files,
e.g., GEOTRACES, WOA, Weber and John, and so on.
Also note that downloading files like this from GitHub is
probably not very robust. However, some of the data files in
Also note that downloading files like this from GitHub is
probably not very robust. However, some of the data files in
the AO repository do not exist anywhere else officially,
therefore this seems like the best solution at this stage.
therefore this seems like the best solution at this stage.
PRs welcome to improve this!
"""
return AO_path
Expand Down
3 changes: 2 additions & 1 deletion src/GroundWaters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using OceanGrids
using Unitful
using Unitful: m, yr
using DataDeps # For storage location of data
using Downloads
using Shapefile
using DataFrames
import OceanGrids: regrid
Expand All @@ -18,7 +19,7 @@ function fallback_download(remotepath, localdir)
@assert(isdir(localdir))
filename = basename(remotepath) # only works for URLs with filename as last part of name
localpath = joinpath(localdir, filename)
Base.download(remotepath, localpath)
Downloads.download(remotepath, localpath)
return localpath
end

Expand Down

0 comments on commit 3c8e143

Please sign in to comment.