Skip to content

Commit 304c4f3

Browse files
committed
Use default_num_points when available
`ClimaDiagnostics` introduced a function to compute the default number of points for the NetCDFWriter. This commit uses this new function when available.
1 parent b438af1 commit 304c4f3

File tree

3 files changed

+42
-30
lines changed

3 files changed

+42
-30
lines changed

.buildkite/Manifest-v1.11.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ version = "0.30.1"
365365

366366
[[deps.ClimaComms]]
367367
deps = ["Adapt", "Logging", "LoggingExtras"]
368-
git-tree-sha1 = "40ad44466dfe0092e18c04bc02c849fe8e095d30"
368+
git-tree-sha1 = "2a96bdd5339bdcd903867a46d1f00110f7b890cc"
369369
uuid = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
370-
version = "0.6.6"
370+
version = "0.6.7"
371371
weakdeps = ["CUDA", "MPI"]
372372

373373
[deps.ClimaComms.extensions]
@@ -399,9 +399,9 @@ version = "0.3.18"
399399

400400
[[deps.ClimaDiagnostics]]
401401
deps = ["Accessors", "ClimaComms", "ClimaCore", "ClimaUtilities", "Dates", "NCDatasets", "OrderedCollections", "SciMLBase"]
402-
git-tree-sha1 = "ec2ee9e870e51a9d8b76decf941f6c9d3d3b1365"
402+
path = "/home/sbozzolo/repos/ClimaDiagnostics.jl/"
403403
uuid = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f"
404-
version = "0.2.13"
404+
version = "0.2.14"
405405

406406
[[deps.ClimaParams]]
407407
deps = ["TOML"]
@@ -417,9 +417,9 @@ version = "0.1.1"
417417

418418
[[deps.ClimaTimeSteppers]]
419419
deps = ["ClimaComms", "DataStructures", "DiffEqBase", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
420-
git-tree-sha1 = "f71d6c31fdfeaa66516ccf904a916e99904e5078"
420+
git-tree-sha1 = "23c8346606e165aa8805f25063f24e39bd8e148d"
421421
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
422-
version = "0.8.4"
422+
version = "0.8.5"
423423
weakdeps = ["BenchmarkTools", "CUDA", "OrderedCollections", "PrettyTables", "StatsBase"]
424424

425425
[deps.ClimaTimeSteppers.extensions]
@@ -2153,9 +2153,9 @@ version = "0.1.0"
21532153

21542154
[[deps.SciMLBase]]
21552155
deps = ["ADTypes", "Accessors", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"]
2156-
git-tree-sha1 = "44397dee277159f224492bcf99c442d2a907c6f5"
2156+
git-tree-sha1 = "846e89af4ec4ba471d3050a70405978cbdf70681"
21572157
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2158-
version = "2.91.0"
2158+
version = "2.91.1"
21592159

21602160
[deps.SciMLBase.extensions]
21612161
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
@@ -2505,9 +2505,9 @@ version = "1.0.2"
25052505

25062506
[[deps.Thermodynamics]]
25072507
deps = ["DocStringExtensions", "KernelAbstractions", "Random", "RootSolvers"]
2508-
git-tree-sha1 = "efe74e0344fd7fb68b831316055290d80a62d9c1"
2508+
git-tree-sha1 = "f708faaf347760e9dcd82beb1a9455c86bdf9911"
25092509
uuid = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
2510-
version = "0.12.11"
2510+
version = "0.12.12"
25112511
weakdeps = ["ClimaParams"]
25122512

25132513
[deps.Thermodynamics.extensions]

src/callbacks/get_callbacks.jl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,7 @@ function get_diagnostics(parsed_args, atmos_model, Y, p, sim_info, output_dir)
3333
num_netcdf_points =
3434
tuple(parsed_args["netcdf_interpolation_num_points"]...)
3535
else
36-
# Estimate the number of points we need to cover the entire domain
37-
# ncolumns is the number of local columns
38-
tot_num_columns =
39-
ClimaComms.nprocs(context) * Fields.ncolumns(axes(Y.c))
40-
if parsed_args["config"] == "plane"
41-
num1, num2 = tot_num_columns, 0
42-
elseif parsed_args["config"] == "sphere"
43-
num2 = round(Int, sqrt(tot_num_columns / 2))
44-
num1 = 2num2
45-
elseif parsed_args["config"] == "box"
46-
num2 = round(Int, sqrt(tot_num_columns))
47-
num1 = num2
48-
elseif parsed_args["config"] == "column"
49-
# We need at least two points horizontally because our column is
50-
# actually a box
51-
num1, num2 = 2, 2
52-
else
53-
error("Uncaught case")
54-
end
55-
num_netcdf_points = (num1, num2, Spaces.nlevels(axes(Y.c)))
36+
num_netcdf_points = default_netcdf_points(axes(Y.c), parsed_args)
5637
end
5738

5839
z_sampling_method =

src/compat.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ClimaCore
22
import ClimaUtilities
33
import ClimaCore: Domains, Spaces, Topologies
4+
import ClimaDiagnostics
45
import RRTMGP
56

67
# To allow for backwards compatibility of ClimaCore:
@@ -96,3 +97,33 @@ else
9697
WallTimeInfo = ClimaUtilities.OnlineLogging.WallTimeInfo
9798
report_walltime = ClimaUtilities.OnlineLogging.report_walltime
9899
end
100+
101+
if pkgversion(ClimaDiagnostics) < v"0.2.14"
102+
function default_netcdf_points(space, parsed_args)
103+
# Estimate the number of points we need to cover the entire domain
104+
# ncolumns is the number of local columns
105+
tot_num_columns =
106+
ClimaComms.nprocs(ClimaComms.context(space)) *
107+
Fields.ncolumns(space)
108+
if parsed_args["config"] == "plane"
109+
num1, num2 = tot_num_columns, 0
110+
elseif parsed_args["config"] == "sphere"
111+
num2 = round(Int, sqrt(tot_num_columns / 2))
112+
num1 = 2num2
113+
elseif parsed_args["config"] == "box"
114+
num2 = round(Int, sqrt(tot_num_columns))
115+
num1 = num2
116+
elseif parsed_args["config"] == "column"
117+
# We need at least two points horizontally because our column is
118+
# actually a box
119+
num1, num2 = 2, 2
120+
else
121+
error("Uncaught case")
122+
end
123+
return (num1, num2, Spaces.nlevels(space))
124+
end
125+
else
126+
function default_netcdf_points(space, _)
127+
return ClimaDiagnostics.Writers.default_num_points(space)
128+
end
129+
end

0 commit comments

Comments
 (0)