sequence.netcdf module#
Write a SequenceModelGrid to a NetCDF file.
- sequence.netcdf.to_netcdf(grid: SequenceModelGrid, filepath: str | PathLike[str], mode: str = 'w', format: str = 'NETCDF4', time: float = 0.0, at: str | Sequence[str] | None = None, ids: dict[str, ndarray[Any, dtype[integer]]] | int | Iterable[int] | slice | None = None, names: None | dict[str, Iterable[str] | None] | str | Iterable[str] = None, with_layers: bool = True) None [source]#
Write a grid and fields to a netCDF file.
- Parameters:
grid (grid_like) – A landlab grid.
filepath (str) – File to which to save the grid.
mode ({'w', 'a'}, optional) – Write (‘w’) or append (‘a’) mode. If mode=’w’, any existing file at this location will be overwritten. If mode=”a”, existing variables will be appended as a new time slice.
format ({'NETCDF4', 'NETCDF4_CLASSIC', 'NETCDF3_64BIT', 'NETCDF3_CLASSIC'}, optional) – File format for the resulting netCDF file.
time (float, optional) – Time to use when adding data. This will be appended to the time variable.
at (str or iterable or str, optional) – Field location(s) on the grid for fields to write. Locations can be ‘node’, ‘link’, ‘patch’, ‘corner’, ‘face’, ‘patch’. The default is to write variables from all field locations.
ids (array_like of int, optional) – Indices of elements to write.
names (iterable or str, optional) – Names of fields to write to the netCDF file.
with_layers (bool, optional) – Indicate if the NetCDF file should contain the grid’s layers.