Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make number of NetCDF points YAML controllable #2600

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading