from_arrays_with_metadata

s100py.s102.utils.from_arrays_with_metadata(depth_grid, uncert_grid, metadata, output_file, nodata_value=None, overwrite=True)

Fills or creates an S102File from the given arguments.

Parameters
  • depth_grid (Union[ndarray, Dataset]) – a numpy or hdf5 dataset object of the rectangular grid of depths

  • uncert_grid (Union[ndarray, Dataset]) – a numpy or hdf5 dataset object of the rectangular grid of uncertainties, lower left corner is the first point

  • metadata (dict) –

    a dictionary of metadata describing the grids passed in, metadata should have the following key/value pairs:

    • ”origin”: tuple of the position (x,y) or (lon, lat) for the reference corner node.

      Other corners are calulated from this corner using the resolution and size of the data array.

    • ”res”: tuple of the resolution (cell size) of each grid cell (x, y).

      Lower left corner is the first point of both resolutions are positive. If a resolution is negative then the grid will be flipped in that dimension and the origin adjusted accordingly.

    • ”horizontalDatumReference”: See S102Root horizontal_datum_reference, ex: “EPSG”.

      ”EPSG” is the default value.

    • ”horizontalDatumValue”: The value for the horizontal data such as the EPSG code ex: 32611

    • ”epoch”:

    • ”geographicIdentifier”: Location of the data, ex: “Long Beach, CA, USA”.

      An empty string (“”) is the default.

    • ”issueDate”:

    • ”metadataFile”: File name for the associated discovery metatadata (xml)

  • 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 – the “no data” value used in the grids

  • overwrite (bool) – if the output_file was an existing S102File then keep any attributes that might have

Return type

S102File