Surfaces#
Regular-grid terrain and bathymetry models. A configured SurfaceModel is
realized against a boundary by Sampler(..., surface=...), and the returned
Farm.surface is a queryable Terrain or Bathymetry object. See
Terrain and bathymetry for examples.
|
A regular grid of physical values in meters. |
|
A surface of elevations relative to a common datum. |
|
A surface of positive water depths, for offshore sites. |
Surface generator realized against a farm boundary. |
|
|
Perlin-noise terrain model with elevations bounded by |
|
Perlin-noise bathymetry model with depths bounded by |
|
Gaussian random-field terrain model around a sloping mean plane. |
|
Gaussian random-field bathymetry model around a sloping mean depth. |
Lightweight terrain and bathymetry surfaces for generated farms.
- class oowl.surfaces.Bathymetry(x, y, values, *, metadata=None)[source]#
A surface of positive water depths, for offshore sites.
- class oowl.surfaces.GaussianBathymetry(mean=50.0, standard_deviation=5.0, *, gradient=(0.0, 0.0), correlation_length=1000.0, resolution=100.0, seed=None)[source]#
Gaussian random-field bathymetry model around a sloping mean depth.
Parameters are as for
GaussianTerrain, with depth in place of elevation. The field is never clipped, so a nonpositive depth on the canonical grid makesgenerateraiseValueError.
- class oowl.surfaces.GaussianTerrain(mean=0.0, standard_deviation=20.0, *, gradient=(0.0, 0.0), correlation_length=1000.0, resolution=100.0, seed=None)[source]#
Gaussian random-field terrain model around a sloping mean plane.
Elevation is
meanplusgradienttimes the offset from the center of the boundary bounds, plus a zero-mean field with squared-exponential covariance of scalestandard_deviationand lengthcorrelation_length, output on a grid spaced byresolution. Lengths are in meters andgradientin meters per meter. Negative elevations are permitted.
- class oowl.surfaces.PerlinBathymetry(depth_range=(10.0, 50.0), *, correlation_length=1000.0, resolution=100.0, seed=None)[source]#
Perlin-noise bathymetry model with depths bounded by
depth_range.depth_rangemust be strictly positive, elseValueError. Other parameters are as forPerlinTerrain.
- class oowl.surfaces.PerlinTerrain(elevation_range=(0.0, 100.0), *, correlation_length=1000.0, resolution=100.0, seed=None)[source]#
Perlin-noise terrain model with elevations bounded by
elevation_range.Elevations in meters stay within the range without necessarily reaching it.
correlation_lengthis the noise-cell size in meters, not a statistical correlation length, andresolutionis the output grid spacing in meters. Nodes shared by grids of different resolution have equal values for the same boundary and seed.
- class oowl.surfaces.Surface(x, y, values, *, metadata=None)[source]#
A regular grid of physical values in meters.
xandyare strictly increasing node coordinates andvalueshas shape(len(y), len(x)). Invalid or nonfinite grids raiseValueError.- at(points)[source]#
Bilinearly interpolate values at
(N, 2)points, shape(N,).Raises
TypeErrorfor non-numeric points andValueErrorfor points outside the grid.- Parameters:
points (ArrayLike)
- Return type:
np.ndarray
- classmethod load(path)[source]#
Read the surface
save()wrote topath.A file holding
depthis aBathymetryand one holdingelevationaTerrain, soTerrain.loadof a depth grid raisesValueError. A grid saved by another tool loads with the metadata{"kind": ..., "source": "netcdf"}.
- plot(ax=None, *, cmap=None, title=None, colorbar=True)[source]#
Plot the surface and return its Matplotlib axes.
cmapdefaults to the style’simage.cmap.- Parameters:
ax (matplotlib.axes.Axes | None)
cmap (str | None)
title (str | None)
colorbar (bool)
- Return type:
- save(path)[source]#
Write the surface to
path, a.ncfile, and return the path.The file is the NetCDF grid
oowl.save()writes beside a site withsurface_format="netcdf",x,yanddepthorelevationin meters, which xarray and windIO read. The metadata is JSON text in the global attributeoowl_metadata, soload()rebuilds an equal surface. RaisesValueErrorfor another suffix or metadata that JSON cannot hold.
- class oowl.surfaces.SurfaceModel[source]#
Surface generator realized against a farm boundary.
A
seedgiven as anumpy.random.Generatoris pinned to one integer at construction, so every farm drawn from the model replays alike. Grids above 50,000,000 nodes or an estimated 4 GiB raiseValueErrorbefore allocation, naming the length to raise.