From b03e8c51e9d07b96be03adacad90218e156f3f65 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Sun, 19 May 2024 11:48:08 -0700 Subject: [PATCH] Add support for ClimaDiagnostics 0.2 See breaking change: https://github.com/CliMA/ClimaDiagnostics.jl/pull/47 --- Project.toml | 2 +- docs/Manifest.toml | 4 ++-- examples/Manifest.toml | 4 ++-- perf/Manifest.toml | 4 ++-- src/callbacks/get_callbacks.jl | 8 ++++++-- src/diagnostics/Diagnostics.jl | 13 +++++++------ 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Project.toml b/Project.toml index b92c8e3511..d3cc9060bc 100644 --- a/Project.toml +++ b/Project.toml @@ -53,7 +53,7 @@ AtmosphericProfilesLibrary = "0.1" CPUSummary = "0.2" ClimaComms = "0.5" ClimaCore = "0.14" -ClimaDiagnostics = "0.1.6" +ClimaDiagnostics = "0.2" ClimaParams = "0.10.4" ClimaTimeSteppers = "0.7.18" ClimaUtilities = "0.1.3" diff --git a/docs/Manifest.toml b/docs/Manifest.toml index d03becd363..08f8f96ed3 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -346,9 +346,9 @@ weakdeps = ["CUDA", "Krylov"] [[deps.ClimaDiagnostics]] deps = ["Accessors", "ClimaComms", "ClimaCore", "Dates", "NCDatasets", "SciMLBase"] -git-tree-sha1 = "34b57fcad8bd3810f70fd131e6f36f2002bfe8e6" +git-tree-sha1 = "aff194804df0fcfcf69a80c58978b84777272619" uuid = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f" -version = "0.1.7" +version = "0.2.2" [[deps.ClimaParams]] deps = ["DocStringExtensions", "TOML", "Test"] diff --git a/examples/Manifest.toml b/examples/Manifest.toml index 54e68cdcd5..3a8b91a072 100644 --- a/examples/Manifest.toml +++ b/examples/Manifest.toml @@ -368,9 +368,9 @@ version = "0.7.6" [[deps.ClimaDiagnostics]] deps = ["Accessors", "ClimaComms", "ClimaCore", "Dates", "NCDatasets", "SciMLBase"] -git-tree-sha1 = "34b57fcad8bd3810f70fd131e6f36f2002bfe8e6" +git-tree-sha1 = "aff194804df0fcfcf69a80c58978b84777272619" uuid = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f" -version = "0.1.7" +version = "0.2.2" [[deps.ClimaParams]] deps = ["DocStringExtensions", "TOML", "Test"] diff --git a/perf/Manifest.toml b/perf/Manifest.toml index 4868623e05..fcd28b37ba 100644 --- a/perf/Manifest.toml +++ b/perf/Manifest.toml @@ -379,9 +379,9 @@ version = "0.7.6" [[deps.ClimaDiagnostics]] deps = ["Accessors", "ClimaComms", "ClimaCore", "Dates", "NCDatasets", "SciMLBase"] -git-tree-sha1 = "34b57fcad8bd3810f70fd131e6f36f2002bfe8e6" +git-tree-sha1 = "aff194804df0fcfcf69a80c58978b84777272619" uuid = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f" -version = "0.1.7" +version = "0.2.2" [[deps.ClimaParams]] deps = ["DocStringExtensions", "TOML", "Test"] diff --git a/src/callbacks/get_callbacks.jl b/src/callbacks/get_callbacks.jl index 9c90086460..46150c9062 100644 --- a/src/callbacks/get_callbacks.jl +++ b/src/callbacks/get_callbacks.jl @@ -34,11 +34,15 @@ function get_diagnostics(parsed_args, atmos_model, Y, p, t_start, dt) num_netcdf_points = (180, 90, 50) end + z_sampling_method = + parsed_args["netcdf_output_at_levels"] ? CAD.LevelsMethod() : + CAD.FakePressureLevelsMethod() + netcdf_writer = CAD.NetCDFWriter( axes(Y.c), p.output_dir, - num_points = num_netcdf_points, - disable_vertical_interpolation = parsed_args["netcdf_output_at_levels"], + num_points = num_netcdf_points; + z_sampling_method, ) writers = (hdf5_writer, netcdf_writer) diff --git a/src/diagnostics/Diagnostics.jl b/src/diagnostics/Diagnostics.jl index 6ba8aa44cc..04d01941b0 100644 --- a/src/diagnostics/Diagnostics.jl +++ b/src/diagnostics/Diagnostics.jl @@ -45,17 +45,18 @@ import ..compute_gm_mixing_length! include(joinpath("..", "utils", "abbreviations.jl")) import ClimaDiagnostics: - DiagnosticVariable, - ScheduledDiagnostic, - average_pre_output_hook!, - DiagnosticsCallback + DiagnosticVariable, ScheduledDiagnostic, average_pre_output_hook! import ClimaDiagnostics.DiagnosticVariables: descriptive_short_name import ClimaDiagnostics.Schedules: EveryStepSchedule, EveryDtSchedule - -import ClimaDiagnostics.Writers: HDF5Writer, NetCDFWriter, write_field! +import ClimaDiagnostics.Writers: + HDF5Writer, + NetCDFWriter, + write_field!, + LevelsMethod, + FakePressureLevelsMethod include("diagnostic.jl")