Skip to content

missing size(::ORCA) method #112

@xkykai

Description

@xkykai

I was trying to use ORCA1() as bathymetry and couldn't do it as it is missing the size method. Here's an MWE:

using NumericalEarth
using Oceananigans

arch = CPU()

Nx = 720 # longitudinal direction 
Ny = 360 # meridional direction 
Nz = 100

z_faces = ExponentialDiscretization(Nz, -6000, 0; scale=1800)
const z_surf = z_faces(Nz)

grid = TripolarGrid(arch;
                    size = (Nx, Ny, Nz),
                    z = z_faces,
                    halo = (7, 7, 7))

bottom_height = regrid_bathymetry(grid; dataset=ORCA1(), minimum_depth=15, major_basins=1, interpolation_passes=55)

which gives an output of

ERROR: MethodError: no method matching size(::ORCA1, ::Symbol)
The function `size` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  size(::Any, ::Any, ::Any)
   @ Oceananigans ~/.julia/packages/Oceananigans/O3Vs1/src/Grids/grid_utils.jl:84
  size(::Any, ::Any, ::Any, ::Any)
   @ Oceananigans ~/.julia/packages/Oceananigans/O3Vs1/src/Grids/grid_utils.jl:84
  size(::DiskArrays.RegularChunks, ::Any)
   @ DiskArrays ~/.julia/packages/DiskArrays/uMiMX/src/chunks.jl:81
  ...

Stacktrace:
 [1] size(metadata::Metadatum{ORCA1, Nothing, Nothing})
   @ NumericalEarth.DataWrangling ~/numericalearth_main/src/DataWrangling/metadata.jl:105
 [2] native_grid(metadata::Metadatum{ORCA1, Nothing, Nothing}, arch::CPU; halo::Tuple{Int64, Int64, Int64})
   @ NumericalEarth.DataWrangling ~/numericalearth_main/src/DataWrangling/metadata_field.jl:25
 [3] _regrid_bathymetry(target_grid::OrthogonalSphericalShellGrid{…}, metadata::Metadatum{…}; height_above_water::Nothing, minimum_depth::Int64, interpolation_passes::Int64, major_basins::Int64)
   @ NumericalEarth.Bathymetry ~/numericalearth_main/src/Bathymetry/regrid_bathymetry.jl:237
 [4] regrid_bathymetry(target_grid::OrthogonalSphericalShellGrid{…}, metadata::Metadatum{…}; height_above_water::Nothing, minimum_depth::Int64, interpolation_passes::Int64, major_basins::Int64, cache::Bool)
   @ NumericalEarth.Bathymetry ~/numericalearth_main/src/Bathymetry/regrid_bathymetry.jl:206
 [5] regrid_bathymetry
   @ ~/numericalearth_main/src/Bathymetry/regrid_bathymetry.jl:182 [inlined]
 [6] #regrid_bathymetry#6
   @ ~/numericalearth_main/src/Bathymetry/regrid_bathymetry.jl:281 [inlined]
 [7] top-level scope
   @ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.

which is saying that size is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions