From 274e8526fd7a5e79f8e4e4820d140b9388d6a848 Mon Sep 17 00:00:00 2001 From: Benoit Pasquier Date: Tue, 25 Jun 2024 15:05:23 +1000 Subject: [PATCH] fix #97 --- Project.toml | 2 +- docs/lit/tutorials/1_ideal_age.jl | 6 +++--- src/OCIM2_48L.jl | 18 +++++++++--------- test/runtests.jl | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Project.toml b/Project.toml index 7cd8d42b..3d889c46 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AIBECS" uuid = "ace601d6-714c-11e9-04e5-89b7fad23838" authors = ["Benoit Pasquier "] -version = "0.13.3" +version = "0.13.4" [deps] Bijectors = "76274a88-744f-5084-9051-94815aaf08c4" diff --git a/docs/lit/tutorials/1_ideal_age.jl b/docs/lit/tutorials/1_ideal_age.jl index 2e72107e..48141d58 100644 --- a/docs/lit/tutorials/1_ideal_age.jl +++ b/docs/lit/tutorials/1_ideal_age.jl @@ -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"). @@ -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 @@ -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. diff --git a/src/OCIM2_48L.jl b/src/OCIM2_48L.jl index 927dc71b..762d476f 100644 --- a/src/OCIM2_48L.jl +++ b/src/OCIM2_48L.jl @@ -94,17 +94,17 @@ 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) @@ -112,9 +112,9 @@ function load() 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) diff --git a/test/runtests.jl b/test/runtests.jl index 5451f44c..06778fbd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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