Skip to content

Commit

Permalink
Merge pull request #2600 from CliMA/gb/diagnostics_ready
Browse files Browse the repository at this point in the history
Make number of NetCDF points YAML controllable
  • Loading branch information
Sbozzolo authored Jan 30, 2024
2 parents 85467c4 + d5b82a6 commit 37677eb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ netcdf_interpolate_z_over_msl:
netcdf_output_at_levels:
help: "Do not perform any vertical interpolation in the output NetCDF files. Instead, interpolate horizontally and output the level. This is incompatible with netcdf_interpolate_z_over_msl when topography is present."
value: false
netcdf_interpolation_num_points:
help: "Override the number of interpolation point for the NetCDF output. This configuration has to be a list of integers, e.g. [180, 90, 10]."
value: ~
warn_allocations_diagnostics:
help: "When true, a dry-run for all the diagnostics is performed to check whether the functions allocate additional memory (which reduces performances)"
value: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ z_max: 70000.0
dt_save_to_sol: "30hours"
job_id: "single_column_radiative_equilibrium_gray"
rad: "gray"
# [2, 2, 80] instead of [1, 1, 80] because Julia ranges are inclusive of the
# extrema. Given that our columns are 3D, we cannot map the horizontal dimension
# with just one point.
netcdf_interpolation_num_points: [2, 2, 80]
11 changes: 11 additions & 0 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,19 @@ function get_diagnostics(parsed_args, atmos_model, spaces)
)

hdf5_writer = CAD.HDF5Writer()

if !isnothing(parsed_args["netcdf_interpolation_num_points"])
num_netcdf_points =
tuple(parsed_args["netcdf_interpolation_num_points"]...)
else
# TODO: Once https://github.com/CliMA/ClimaCore.jl/pull/1567 is merged,
# dispatch over the Grid type
num_netcdf_points = (180, 90, 50)
end

netcdf_writer = CAD.NetCDFWriter(;
spaces,
num_points = num_netcdf_points,
interpolate_z_over_msl = parsed_args["netcdf_interpolate_z_over_msl"],
disable_vertical_interpolation = parsed_args["netcdf_output_at_levels"],
)
Expand Down

0 comments on commit 37677eb

Please sign in to comment.