Skip to content

Commit

Permalink
Fix loading of OCIM2-48L (#98)
Browse files Browse the repository at this point in the history
fix #97
  • Loading branch information
briochemc authored Jun 25, 2024
1 parent fe509e7 commit eb5e3cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 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.13.3"
version = "0.13.4"

[deps]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Expand Down
6 changes: 3 additions & 3 deletions docs/lit/tutorials/1_ideal_age.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#md # DeVries, T., & Holzer, M. (2019). Radiocarbon and helium isotope constraints on deep ocean ventilation and mantle‐³He sources. Journal of Geophysical Research: Oceans, 124, 3036–3057. doi:[10.1029/2018JC014716](https://doi.org/10.1029/2018JC014716)

using AIBECS
grd, TOCIM2 = OCIM2.load()
grd, TOCIM2_48L = OCIM2_48L.load()

#md # !!! note
#md # If it's your first time, Julia will ask you to download the OCIM2, in which case you should accept (i.e., type `y` and "return").
Expand All @@ -42,7 +42,7 @@ grd, TOCIM2 = OCIM2.load()
#nb # > If it's your first time, Julia will ask you to download the OCIM2, in which case you should accept (i.e., type `y` and "return").
#nb # > Once downloaded, AIBECS will remember where it downloaded the file and it will only load it from your laptop.

# `grd` is an `OceanGrid` object containing information about the 3D grid of the OCIM2 circulation and `TOCIM2` is the transport matrix representing advection and diffusion.
# `grd` is an `OceanGrid` object containing information about the 3D grid of the OCIM2 circulation and `TOCIM2_48L` is the transport matrix representing advection and diffusion.

# The local sources and sinks for the age take the form

Expand Down Expand Up @@ -75,7 +75,7 @@ p = IdealAgeParameters(1.0, 30.0)

# We now use the AIBECS to generate the state function $\boldsymbol{F}$ (and its Jacobian) via

F = AIBECSFunction(TOCIM2, G)
F = AIBECSFunction(TOCIM2_48L, G)

# Now that `F` and `p` are defined, we are going to solve for the steady-state.
# But first, we must create a `SteadyStateProblem` object that contains `F`, `p`, and an initial guess `x_init` for the age.
Expand Down
18 changes: 9 additions & 9 deletions src/OCIM2_48L.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,27 @@ function load()
# Create grid object from NetCDF file variables
# TODO: Add Hyrothermal He fluxes as for the OCIM2 load function
grid = Dataset(joinpath(files_path, "OCIM2_48L_base_data.nc"), "r") do ds
wet3D = ds["ocnmask"][:] .== 1
wet3D = Array(ds["ocnmask"]) .== 1
nlat, nlon, ndepth = size(wet3D)
lat_3D = ds["tlat"][:]°
lon_3D = ds["tlon"][:]°
depth_3D = ds["tz"][:]m
lat_3D = Array(ds["tlat"])°
lon_3D = Array(ds["tlon"])°
depth_3D = Array(ds["tz"])m
lat = unique(lat_3D)
lon = unique(lon_3D)
depth = unique(depth_3D)
ulat = unique(ds["ulon"][:]# ulat↔ulon in OCIM2-48L original files
ulon = unique(ds["ulat"][:]# ulat↔ulon in OCIM2-48L original files
depth_top_3D = ds["wz"][:]m
ulat = unique(Array(ds["ulon"])# ulat↔ulon in OCIM2-48L original files
ulon = unique(Array(ds["ulat"])# ulat↔ulon in OCIM2-48L original files
depth_top_3D = Array(ds["wz"])m
depth_top = unique(depth_top_3D)
δlat = 2(ulat - lat)
δlon = 2(ulon - lon)
δdepth = 2(depth - depth_top)
R = 6371.0km
δy = R * δlat ./ 360°
δy_3D = repeat(reshape(δy, (nlat,1,1)), outer=(1,nlon,ndepth))
A_3D = ds["area"][:]m^2
A_3D = Array(ds["area"])m^2
δx_3D = A_3D ./ δy_3D
volume_3D = ds["vol"]m^3
volume_3D = Array(ds["vol"])m^3
δz_3D = volume_3D ./ A_3D
A_2D = A_3D[:,:,1]
nboxes = count(wet3D)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using Plots
# For CI, make sure the downloads do not hang
ENV["DATADEPS_ALWAYS_ACCEPT"] = true

test_setup_only = [:OCIM1, :OCIM0, :OCCA]
test_setup_only = [:OCIM2_48L, :OCIM1, :OCIM0, :OCCA]
# Using `include` evaluates at global scope,
# so `Circulation` must be changed at the global scope too.
# This is why there is an `eval` in the for loop(s) below
Expand Down

4 comments on commit eb5e3cb

@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/109720

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.13.4 -m "<description of version>" eb5e3cb7950eb2d7773938ac93d5dbab27c0fd52
git push origin v0.13.4

@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 register

Release notes:

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Error while trying to register: Version 0.13.4 already exists

Please sign in to comment.