from_arrays

s100py.s102.utils.from_arrays(depth_grid, uncert_grid, output_file, nodata_value=None, flip_x=False, flip_y=False, overwrite=True)

Creates or updates an S102File object based on numpy array/h5py datasets. Calls create_s102 then fills in the HDF5 datasets with the supplied depth_grid and uncert_grid. Fills the number of points areas and any other appropriate places in the HDF5 file per the S102 spec.

Raises an S102Exception if the shapes of the depth and uncertainty (if not None) grids are not equal.

Parameters
  • depth_grid (Union[ndarray, Dataset]) –

  • uncert_grid (Union[ndarray, Dataset]) – The uncertainty dataset to embed in the object. If None then a numpy.zeros array will be created in the appropriate shape to be stored in the file.

  • output_file – Can be an S102File object or anything the h5py.File would accept, e.g. string file path, tempfile obect, BytesIO etc.

  • nodata_value – Value used to denote an empty cell in the grid. Used in finding the min/max and then converted to the S102 fillValue.

  • flip_x (bool) – boolean if the data should be mirrored on x coordinate (i.e. the original grid is right to left) Flips are done here so we can implement a chunked read/write to save memory

  • flip_y (bool) – boolean if the data should be mirrored on y coordinate (i.e. the original grid is top to bottom) Flips are done here so we can implement a chunked read/write to save memory

  • overwrite (bool) – If updating an existing file then set this option to False in order to retain data (not sure this is needed).

Returns

The object created or updated by this function.

Return type

S102File