Skip to content

Commit

Permalink
update deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Feb 9, 2024
1 parent b1fdd23 commit 0be8968
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion experiments/AMIP/cli_options.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ArgParse
function argparse_settings()
s = ArgParse.ArgParseSettings()
ArgParse.@add_arg_table s begin
ArgParse.@add_arg_table! s begin
# ClimaCoupler flags
"--run_name"
help = "Name of this run."
Expand Down
2 changes: 2 additions & 0 deletions experiments/AMIP/user_io/amip_visualizer.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ClimaComms
include("plot_helper.jl")

"""
Expand Down Expand Up @@ -77,6 +78,7 @@ function read_latest_model_data(name::Symbol, filedir::String, root::String)
varfile_root = @sprintf "%s%s" string(name) root
filename = glob("*" * varfile_root * "*", filedir)[end]

comms_ctx = ClimaComms.SingletonCommsContext()
hdfreader = InputOutput.HDF5Reader(filename)
var = InputOutput.read_field(hdfreader, string(name))
close(hdfreader)
Expand Down
2 changes: 1 addition & 1 deletion src/Regridder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function hdwrite_regridfile_rll_to_cgll(
space2d_undistributed = Spaces.SpectralElementSpace2D(topology, Spaces.Quadratures.GLL{Nq}())

if space isa Spaces.ExtrudedFiniteDifferenceSpace
vert_center_space = Spaces.CenterFiniteDifferenceSpace(space.vertical_topology.mesh)
vert_center_space = Spaces.CenterFiniteDifferenceSpace(Spaces.vertical_topology(space).mesh)
space_undistributed = Spaces.ExtrudedFiniteDifferenceSpace(space2d_undistributed, vert_center_space)
else
space_undistributed = space2d_undistributed
Expand Down
2 changes: 1 addition & 1 deletion test/TestHelper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function create_space(
mesh = Meshes.EquiangularCubedSphere(domain, ne)

if comms_ctx isa ClimaComms.SingletonCommsContext
topology = Topologies.Topology2D(mesh, Topologies.spacefillingcurve(mesh))
topology = Topologies.Topology2D(comms_ctx, mesh, Topologies.spacefillingcurve(mesh))
else
topology = Topologies.DistributedTopology2D(comms_ctx, mesh, Topologies.spacefillingcurve(mesh))
end
Expand Down
4 changes: 2 additions & 2 deletions test/bcreader_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ for FT in (Float32, Float64)
Nq = 4
domain = Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
boundary_space_t = Spaces.SpectralElementSpace2D(topology, quad)
monthly_fields = (zeros(boundary_space_t), ones(boundary_space_t))
Expand Down Expand Up @@ -349,7 +349,7 @@ for FT in (Float32, Float64)
Nq = 4
domain = Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
boundary_space_t = Spaces.SpectralElementSpace2D(topology, quad)
land_fraction_t = Fields.zeros(boundary_space_t)
Expand Down
1 change: 0 additions & 1 deletion test/component_model_tests/bucket_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using ClimaCoupler.TestHelper: create_space
using ClimaCore: Fields, Spaces

include(pkgdir(ClimaCoupler, "experiments/AMIP/components/land/bucket_init.jl"))
include(pkgdir(ClimaCoupler, "experiments/AMIP/components/land/bucket_utils.jl"))

for FT in (Float32, Float64)
@testset "dss_state! BucketSimulation for FT=$FT" begin
Expand Down
4 changes: 3 additions & 1 deletion test/experiment_tests/coupled_sims.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using Random
using ClimaCoupler, Dates, Unitful
using IntervalSets
using ClimaCore: Domains, Meshes, Geometry, Topologies, Spaces, Fields, Operators
using ClimaComms

# Load file to test
include("../../experiments/ClimaCore/CoupledSims/coupled_sim.jl")
Expand Down Expand Up @@ -40,7 +41,8 @@ function spectral_space_2D(; n1 = 1, n2 = 1, Nij = 4)
x2boundary = (:south, :north),
)
mesh = Meshes.RectilinearMesh(domain, n1, n2)
grid_topology = Topologies.Topology2D(mesh)
comms_ctx = ClimaComms.SingletonCommsContext()
grid_topology = Topologies.Topology2D(comms_ctx, mesh)

quad = Spaces.Quadratures.GLL{Nij}()
space = Spaces.SpectralElementSpace2D(grid_topology, quad)
Expand Down
2 changes: 1 addition & 1 deletion test/regridder_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ for FT in (Float32, Float64)
# read in data on CGLL grid from the last saved date
date1 = TimeManager.strdate_to_datetime.(string(Int(time[end])))
cgll_path = joinpath(REGRID_DIR, "$(hd_outfile_root)_$date1.hdf5")
hdfreader = InputOutput.HDF5Reader(cgll_path)
hdfreader = InputOutput.HDF5Reader(cgll_path, comms_ctx)
T_cgll = InputOutput.read_field(hdfreader, varname)
Base.close(hdfreader)

Expand Down

0 comments on commit 0be8968

Please sign in to comment.