Skip to content

Commit

Permalink
Fix AWESOME-OCIM data and code download (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc authored Jul 23, 2021
1 parent efbfcf2 commit 8e2aaf0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AIBECS"
uuid = "ace601d6-714c-11e9-04e5-89b7fad23838"
authors = ["Benoit Pasquier <[email protected]>"]
version = "0.10.2"
version = "0.10.3"

[deps]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Expand Down
42 changes: 28 additions & 14 deletions src/AO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ function fallback_download(remotepath, localdir)
end


function register_AO_files(AO_version)
function register_AO_files()
register(
DataDep(
string("AO_", AO_version, "_files"),
"AWESOME-OCIM",
"""
References for OCIM1:
- DeVries, T., 2014: The oceanic anthropogenic CO2 sink: Storage, air‐sea fluxes, and transports over the industrial era, Global Biogeochem. Cycles, 28, 631–647, doi:10.1002/2013GB004739.
- DeVries, T. and F. Primeau, 2011: Dynamically and Observationally Constrained Estimates of Water-Mass Distributions and Ages in the Global Ocean. J. Phys. Oceanogr., 41, 2381–2401, https://doi.org/10.1175/JPO-D-10-05011.1
- John, S. G., Liang, H., Weber, T., Devries, T., Primeau, F., Moore, K., Holzer, M., Mahowald, N., Gardner, W., Mishonov, A., Richardson, M., J., Faugere, Y., and Taburet, G. (2020). AWESOME OCIM: A simple, flexible, and powerful tool for modeling elemental cycling in the oceans. Chemical Geology, 533, 119403. doi: 10.1016/j.chemgeo.2019.119403.
""",
string("http://www.mtel.rocks/mtel/awesomeOCIM_files/AwesomeOCIM_", AO_version, ".zip"),
"46b8bfad2b9c73e04cbb2688efd7b477af6ce61ad0340aa894c950c5ba53fa14",
"https://github.com/hengdiliang/AWESOME-OCIM/archive/refs/heads/master.zip",
sha2_256,
fetch_method = fallback_download,
post_fetch_method = unpack
)
Expand All @@ -33,18 +32,33 @@ end
download_and_unpack
Downloads and unpacks the AO zip file from the MTEL website.
Returns the local path of where the AO is installed for you.
"""
function download_and_unpack(AO_version)
register_AO_files(AO_version)
@info """You are about to download (and unpack) the AWESOME OCIM (AO) $AO_version files as a zip file from the MTEL website (https://www.mtel.rocks).
function download_and_unpack()
register_AO_files()
AO_path = datadep"AWESOME-OCIM"
@info """You are about to download (and unpack) the AWESOME OCIM (AO)
files as a zip file from GitHub and unpack them into:
Please check with Seth John ([email protected]) for references to cite if you use the other data contained in the AO files, e.g., GEOTRACES, WOA, etc.
(The references to DeVries et al. pertain to the OCIM v1 product, which is essentially the transport matrix representing the circulation.)
$AO_path
You can run
tree $AO_path
(in shell mode) to check its contents.
Please check with Seth John ([email protected]) 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
the AO repository do not exist anywhere else officially,
therefore this seems like the best solution at this stage.
PRs welcome to improve this!
"""
files_path = @datadep_str string("AO_", AO_version, "_files/")
println("AO folder contains:\n",readdir(files_path)...)
return nothing
return AO_path
end

end # module
Expand Down
4 changes: 4 additions & 0 deletions test/AO.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@testset begin "AWESOME OCIM"
AO_path = AO.download_and_unpack()
@test isdir(AO_path)
end
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using DiffEqBase
using ForwardDiff, DualNumbers
using DataFrames
using Distributions
using DataDeps
using Plots

# For CI, make sure the downloads do not hang
Expand Down Expand Up @@ -52,7 +53,7 @@ test_everything = [:Primeau_2x2x2, :TwoBoxModel, :Archer_etal_2000]
end
end


include("AO.jl")



Expand Down

2 comments on commit 8e2aaf0

@briochemc
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/41381

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.3 -m "<description of version>" 8e2aaf071956aa73fb38a87d72000a83dcd7af14
git push origin v0.10.3

Please sign in to comment.