dfsu.Dfsu3D

dfsu.Dfsu3D(self, filename)

Attributes

Name Description
deletevalue File delete value.
end_time File end time.
geometry2d The 2d geometry for a 3d object.
items List of items.
n_items Number of items.
n_layers Maximum number of layers.
n_sigma_layers Number of sigma layers.
n_timesteps Number of time steps.
n_z_layers Maximum number of z-layers.
start_time File start time.
timestep Time step size in seconds.

Methods

Name Description
append Append data to a dfsu file.
extract_surface_elevation_from_3d Extract surface elevation from a 3d dfsu file (based on zn)
read Read data from a dfsu file.

append

dfsu.Dfsu3D.append(ds, validate=True)

Append data to a dfsu file.

Parameters

Name Type Description Default
ds Dataset Dataset to append required
validate bool Validate that the dataset to append has the same geometry and items, by default True True

extract_surface_elevation_from_3d

dfsu.Dfsu3D.extract_surface_elevation_from_3d(n_nearest=4)

Extract surface elevation from a 3d dfsu file (based on zn) to a new 2d dfsu file with a surface elevation item.

Parameters

Name Type Description Default
n_nearest int number of points for spatial interpolation (inverse_distance), default=4 4

read

dfsu.Dfsu3D.read(
    items=None,
    time=None,
    elements=None,
    area=None,
    x=None,
    y=None,
    z=None,
    layers=None,
    keepdims=False,
    dtype=np.float32,
    error_bad_data=True,
    fill_bad_data_value=np.nan,
)

Read data from a dfsu file.

Parameters

Name Type Description Default
items str | int | Sequence[str | int] | None Read only selected items, by number (0-based), or by name None
time int | str | slice | None Read only selected time steps, by default None (=all) None
keepdims bool When reading a single time step only, should the time-dimension be kept in the returned Dataset? by default: False False
area tuple[float, float, float, float] | None Read only data inside (horizontal) area given as a bounding box (tuple with left, lower, right, upper) or as list of coordinates for a polygon, by default None None
x float | None Read only data for elements containing the (x,y,z) points(s) None
y float | None Read only data for elements containing the (x,y,z) points(s) None
z float | None Read only data for elements containing the (x,y,z) points(s) None
layers int | Layer | Sequence[int] | None Read only data for specific layers, by default None None
elements Sequence[int] | np.ndarray | None Read only selected element ids, by default None None
error_bad_data bool raise error if data is corrupt, by default True, True
fill_bad_data_value float fill value for to impute corrupt data, used in conjunction with error_bad_data=False default np.nan np.nan
dtype Any Data type to read, by default np.float32 np.float32

Returns

Name Type Description
Dataset A Dataset with data dimensions [t,elements]