Skip to content

Commit eb5e3cb

Browse files
authored
Fix loading of OCIM2-48L (#98)
fix #97
1 parent fe509e7 commit eb5e3cb

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AIBECS"
22
uuid = "ace601d6-714c-11e9-04e5-89b7fad23838"
33
authors = ["Benoit Pasquier <[email protected]>"]
4-
version = "0.13.3"
4+
version = "0.13.4"
55

66
[deps]
77
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"

docs/lit/tutorials/1_ideal_age.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#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)
3434

3535
using AIBECS
36-
grd, TOCIM2 = OCIM2.load()
36+
grd, TOCIM2_48L = OCIM2_48L.load()
3737

3838
#md # !!! note
3939
#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").
@@ -42,7 +42,7 @@ grd, TOCIM2 = OCIM2.load()
4242
#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").
4343
#nb # > Once downloaded, AIBECS will remember where it downloaded the file and it will only load it from your laptop.
4444

45-
# `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.
45+
# `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.
4646

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

@@ -75,7 +75,7 @@ p = IdealAgeParameters(1.0, 30.0)
7575

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

78-
F = AIBECSFunction(TOCIM2, G)
78+
F = AIBECSFunction(TOCIM2_48L, G)
7979

8080
# Now that `F` and `p` are defined, we are going to solve for the steady-state.
8181
# But first, we must create a `SteadyStateProblem` object that contains `F`, `p`, and an initial guess `x_init` for the age.

src/OCIM2_48L.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,27 @@ function load()
9494
# Create grid object from NetCDF file variables
9595
# TODO: Add Hyrothermal He fluxes as for the OCIM2 load function
9696
grid = Dataset(joinpath(files_path, "OCIM2_48L_base_data.nc"), "r") do ds
97-
wet3D = ds["ocnmask"][:] .== 1
97+
wet3D = Array(ds["ocnmask"]) .== 1
9898
nlat, nlon, ndepth = size(wet3D)
99-
lat_3D = ds["tlat"][:]°
100-
lon_3D = ds["tlon"][:]°
101-
depth_3D = ds["tz"][:]m
99+
lat_3D = Array(ds["tlat"])°
100+
lon_3D = Array(ds["tlon"])°
101+
depth_3D = Array(ds["tz"])m
102102
lat = unique(lat_3D)
103103
lon = unique(lon_3D)
104104
depth = unique(depth_3D)
105-
ulat = unique(ds["ulon"][:]# ulat↔ulon in OCIM2-48L original files
106-
ulon = unique(ds["ulat"][:]# ulat↔ulon in OCIM2-48L original files
107-
depth_top_3D = ds["wz"][:]m
105+
ulat = unique(Array(ds["ulon"])# ulat↔ulon in OCIM2-48L original files
106+
ulon = unique(Array(ds["ulat"])# ulat↔ulon in OCIM2-48L original files
107+
depth_top_3D = Array(ds["wz"])m
108108
depth_top = unique(depth_top_3D)
109109
δlat = 2(ulat - lat)
110110
δlon = 2(ulon - lon)
111111
δdepth = 2(depth - depth_top)
112112
R = 6371.0km
113113
δy = R * δlat ./ 360°
114114
δy_3D = repeat(reshape(δy, (nlat,1,1)), outer=(1,nlon,ndepth))
115-
A_3D = ds["area"][:]m^2
115+
A_3D = Array(ds["area"])m^2
116116
δx_3D = A_3D ./ δy_3D
117-
volume_3D = ds["vol"]m^3
117+
volume_3D = Array(ds["vol"])m^3
118118
δz_3D = volume_3D ./ A_3D
119119
A_2D = A_3D[:,:,1]
120120
nboxes = count(wet3D)

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using Plots
1616
# For CI, make sure the downloads do not hang
1717
ENV["DATADEPS_ALWAYS_ACCEPT"] = true
1818

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

0 commit comments

Comments
 (0)