Dfs2
Dfs2(self, filename, type='horizontal')
Class for reading/writing dfs2 files.
Parameters
| filename |
str | Path |
Path to dfs2 file |
required |
| type |
Literal['horizontal', 'spectral', 'vertical'] |
horizontal, spectral or vertical, default horizontal |
'horizontal' |
Attributes
| deletevalue |
File delete value. |
| dx |
Step size in x direction. |
| dy |
Step size in y direction. |
| end_time |
File end time. |
| geometry |
Spatial information. |
| is_geo |
Are coordinates geographical (LONG/LAT)? |
| items |
List of items. |
| latitude |
Origin latitude. |
| longitude |
Origin longitude. |
| n_items |
Number of items. |
| n_timesteps |
Number of time steps. |
| nx |
Number of values in the x-direction. |
| ny |
Number of values in the y-direction. |
| orientation |
Orientation (in own CRS). |
| origin |
Origin (in own CRS). |
| shape |
Tuple with number of values in the t-, y-, x-direction. |
| start_time |
File start time. |
| timestep |
Time step size in seconds. |
| x0 |
Start point of x values (often 0). |
| y0 |
Start point of y values (often 0). |
Methods
| append |
Append a Dataset to an existing dfs2 file. |
| read |
Read data from a dfs2 file. |
append
Dfs2.append(ds, validate=True)
Append a Dataset to an existing dfs2 file.
Parameters
| ds |
Dataset |
Dataset to append |
required |
| validate |
bool |
Check if the dataset to append has the same geometry and items as the original file, by default True |
True |
Notes
The original file is modified.
read
Dfs2.read(items=None, time=None, area=None, keepdims=False, dtype=np.float32)
Read data from a dfs2 file.
Parameters
| items |
str | int | Sequence[str | int] | None |
Read only selected items, by number (0-based), or by name |
None |
| time |
int | str | slice | Sequence[int] | 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) coordinates |
None |
| dtype |
Any |
Define the dtype of the returned dataset (default = np.float32) |
np.float32 |