@@ -320,17 +320,18 @@ function hypsography_function_from_topography(
320320 comms_ctx,
321321)
322322 return function (h_grid, z_grid)
323+ topography isa NoTopography && return Hypsography. Flat ()
324+
323325 # Create horizontal space to work with topography
324- h_topology = Spaces. topology (Spaces. SpectralElementSpace1D (h_grid))
325326 h_space = if h_grid isa Grids. SpectralElementGrid1D
326- Spaces. SpectralElementSpace1D (h_topology, h_grid. quadrature_style)
327+ Spaces. SpectralElementSpace1D (h_grid)
328+ elseif h_grid isa Grids. SpectralElementGrid2D
329+ Spaces. SpectralElementSpace2D (h_grid)
327330 else
328- Spaces . SpectralElementSpace2D (h_topology, h_grid. quadrature_style )
331+ error ( " Unsupported horizontal grid type $( typeof ( h_grid)) " )
329332 end
330333
331- if topography isa NoTopography
332- z_surface = zeros (h_space)
333- elseif topography isa EarthTopography
334+ if topography isa EarthTopography
334335 z_surface = SpaceVaryingInput (
335336 AA. earth_orography_file_path (;
336337 context = ClimaComms. context (h_space),
@@ -344,9 +345,7 @@ function hypsography_function_from_topography(
344345 @info " Using $(nameof (typeof (topography))) orography"
345346 end
346347
347- if topography isa NoTopography
348- hypsography = Hypsography. Flat ()
349- elseif topography isa EarthTopography
348+ if topography isa EarthTopography
350349 mask (x:: FT ) where {FT} = x * FT (x > 0 )
351350 z_surface = @. mask (z_surface)
352351 # diff_cfl = νΔt/Δx²
0 commit comments