dfsu.Dfsu2DV

dfsu.Dfsu2DV(self, filename)

Attributes

Name Description
deletevalue File delete value.
end_time File end time.
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.
plot_vertical_profile Plot unstructured vertical profile.
read Read data from a dfsu file.

append

dfsu.Dfsu2DV.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

plot_vertical_profile

dfsu.Dfsu2DV.plot_vertical_profile(
    values,
    cmin=None,
    cmax=None,
    label='',
    **kwargs,
)

Plot unstructured vertical profile.

Parameters

Name Type Description Default
values np.ndarray | DataArray value for each element to plot required
cmin float | None lower bound of values to be shown on plot, default:None None
cmax float | None upper bound of values to be shown on plot, default:None None
title axes title required
label str colorbar label ''
cmap colormap, default viridis required
figsize specify size of figure required
ax Adding to existing axis, instead of creating new fig required
**kwargs Any Additional keyword arguments {}

Returns

Name Type Description
<matplotlib.axes>

read

dfsu.Dfsu2DV.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]